getDatabaseModel function

Future<Map<String, dynamic>?> getDatabaseModel(
  1. Map<String, dynamic> context
)

This function runs in an isolated thread. Please use Database.getModel

Implementation

Future<Map<String, dynamic>?> getDatabaseModel(
    Map<String, dynamic> context) async {
  List<Map<String, dynamic>> models = context['models'];
  try {
    for (int i = 0; i < models.length; i++) {
      if (models[i]['id'] == context['id']) {
        return models[i];
      }
    }
  } catch (e) {
    print(e);
  }

  return null;
}