platforms_source_gen_init function Null safety

Future<List<GenClassBean>> platforms_source_gen_init(
  1. String dir
)

Implementation

Future<List<GenClassBean>> platforms_source_gen_init(String dir) async {
  List<GenClassBean> list = [];
  Directory directory = Directory(dir);
  var listFile = directory
      .listSync()
      .takeWhile((value) => value is File)
      .map((e) => e as File)
      .toList();

  for (int i = 0; i < listFile.length; i++) {
    if (listFile[i] is File) {
      List<GenClassBean> aaa = await _parseFile(listFile[i]);
      list.addAll(aaa);
    }
  }
  return list;
}