readData<T> method

Future<List<T>> readData<T>(
  1. int n
)

Implementation

Future<List<T>> readData<T>(int n) async {
  final result = <T>[];
  var i = 1, left = n;
  while (left > 0) {
    var parts = await readList();
    for (final part in parts) {
      result.add(_parse<T>(part));
      if (i == n) return result;
      i++;
    }
    left = left - parts.length;
  }
  return result;
}