read method

  1. @override
Future<Map<String, dynamic>> read (
  1. String id,
  2. [Map<String, dynamic> params]
)
override

GET /:id Fetch one resource, by its ID

Implementation

@override
Future<Map<String, dynamic>> read(String id,
    [Map<String, dynamic> params]) async {
  var found = await collection.document(id);

  if (found == null) {
    throw AngelHttpException.notFound(message: 'No record found for ID $id');
  }

  var doc = await found.get();
  return _mapWithId(doc);
}