selectAll method

Future<List<Model>> selectAll()

Implementation

Future<List<Model>> selectAll() async {
  final List<Map<String, dynamic>> list = [];
  if (kIsWeb) {
    bool isRowMightEmpty;
    Map<String, dynamic> object;
    String? value;
    do {
      isRowMightEmpty = true;
      object = {};
      for (int index = 0; index < sqfliteTable.columnList.length; index++) {
        value = await Preference(
                '${sqfliteTable.name}${sqfliteTable.columnList[index].name}${list.length}')
            .value;
        object.putIfAbsent(sqfliteTable.columnList[index].name, () => value);
        if (isRowMightEmpty) {
          isRowMightEmpty =
              object[sqfliteTable.columnList[index].name] == null;
        }
      }
      if (!isRowMightEmpty) {
        list.add(object);
      }
    } while (!isRowMightEmpty);
  } else {
    list.addAll(await (await sqflite).query('`${sqfliteTable.name}`'));
  }
  final List<Model> list2 = [];
  for (final Map<String, dynamic> object in list) {
    list2.add((await toModel(object))!);
  }
  return list2;
}