Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

dart read file

import 'dart:convert';
import 'dart:io';

void main(List<String> args) async {
  var myFile = File('myFile');
  // asynchronous
  List<String> linesAsync = await myFile.readAsLines();
  // synchronous
  List<String> linesSync = myFile.readAsLinesSync();
  // stream
  Stream<String> linesStream = myFile.openRead()
  									 .transform(utf8.decoder)
                                     .transform(LineSplitter());
}
 
PREVIOUS NEXT
Tagged: #dart #read #file
ADD COMMENT
Topic
Name
3+7 =