index<T extends Model> static method

Future<List<T>> index<T extends Model>()

Implementation

static Future<List<T>> index<T extends Model>() async {
  final constructor = _jsonConstructors[T];
  if (constructor == null) return [];

  try {
    final jsonRecords = await jsonIndex<T>();
    return jsonRecords.map((item) => constructor(item) as T).toList();
  } catch (e, stack) {
    print('Error reading table file: $e\n$stack');
    return [];
  }
}