Last active
          September 9, 2015 17:05 
        
      - 
      
- 
        Save kwalrath/a6907e26b96678b75303 to your computer and use it in GitHub Desktop. 
    homepage_jw
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'dart:html' show HttpRequest; | |
| main() async { | |
| // Asychronously get text to display. | |
| var lines = await getLines(); | |
| // If result is non-null, print it. | |
| lines?.forEach((line) => print(line)); | |
| } | |
| // Reads a file, returning all lines with the string | |
| // 'jabberwock'. | |
| getLines() async { | |
| var jabber = await HttpRequest.getString( | |
| 'https://www.dartlang.org/f/jabberwocky.txt'); | |
| var lines = jabber.split('\n'); | |
| lines.retainWhere((line) => | |
| line.toLowerCase().contains('jabberwock')); | |
| return lines; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment