create method

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

POST / Create a resource. This endpoint should return

Implementation

// the created resource.
@override
Future<Map<String, dynamic>> create(Map<String, dynamic> data,
    [Map<String, dynamic> params]) async {
  var item = _removeSensitive(data);

  try {
    var doc = await collection.add(item);
    return _mapWithId(doc);
  } catch (e, st) {
    throw AngelHttpException(e, stackTrace: st);
  }
}