get<R> method

  1. @override
Future<Response<T>> get<R>(
  1. String id, {
  2. Map<String, dynamic>? extra,
  3. R? source(
    1. R parent
    )?,
})
override

Implementation

@override
Future<Response<T>> get<R>(
  String id, {
  Map<String, dynamic>? extra,
  R? Function(R parent)? source,
}) async {
  final response = Response<T>();
  try {
    final result = await _source(source).doc(id).get();
    if (result.exists && result.data() != null) {
      return response.copy(data: build(result.data()));
    } else {
      return response.copy(error: "Data not found!");
    }
  } catch (_) {
    return response.copy(error: _.toString());
  }
}