get method

Future<XData?> get(
  1. dynamic field,
  2. dynamic value
)

Implementation

Future<XData?> get(field, value) async {
  if (fields.where((element) => element.field == field).isEmpty) {
    throw Exception('Field $field not found');
  }
  var dataSet = await _getAllDocs();
  return dataSet
          .where((element) => element.data[field] == value)
          .toList()
          .isEmpty
      ? null
      : dataSet.where((element) => element.data[field] == value).toList()[0];
}