addNewParty method

Future<Null> addNewParty ()

Pushes the newly created party on the DB.

Implementation

Future<Null> addNewParty() async {
  // Firebase Firestore reference
  final CollectionReference reference = _partiesCollectionReference;
  Duration timeoutDuration = new Duration(seconds: 30);
  try {
    reference
        .add(_partyMapper())
        .catchError(() => throw new Exception('UPLOAD ERROR'))
        .timeout(timeoutDuration,
            onTimeout: () =>
                throw new TimeoutException('TIMEOUT', timeoutDuration));
  } on TimeoutException {
    print(TimeoutException);
  } on Exception catch (e) {
    print('Error uploading the party, $e');
  }
}