sendUser method

Future<Null> sendUser ()

Uploads the user on the DB, it is used during the creation of the user, within SignUpButton.

Implementation

Future<Null> sendUser() async {
  print('sending user...');
  Duration timeoutDuration = new Duration(seconds: 60);
  final DocumentReference reference =
      Firestore.instance.collection('users').document(uid);
  try {
    await reference
        .setData(_userMapper())
        .timeout(timeoutDuration,
            onTimeout: () =>
                throw new TimeoutException('TIMEOUT', timeoutDuration))
        .catchError(() => throw Exception);
  } on TimeoutException {
    print(TimeoutException);
  } on Exception catch (e) {
    print(e);
  }
}