add method

Future<String> add(
  1. Map<String, dynamic> data
)

Add the provided Map object.

Implementation

Future<String> add(Map<String, dynamic> data) async {
  // ignore: avoid_as
  final User user = await (currentUser() as Future<User>);
  data['uid'] = user.uid;
  return _collection!.add(data).then((ref) {
    final List<String> path = ref.path.split('/');
    return path.last;
  }).catchError((Object ex) {
    setError(ex);
    return '';
  });
}