Unhandled Exception: Null check operator used on a null value E/flutter
waleed099 opened this issue · 0 comments
waleed099 commented
void login(String code, RunMutation runMutation) async {
final PhoneAuthCredential credential = PhoneAuthProvider.credential(
verificationId: widget.verificationId, smsCode: code);
final UserCredential cr =
await FirebaseAuth.instance.signInWithCredential(credential);
final String firebaseToken = await cr.user!.getIdToken();
final QueryResult qe =
await runMutation({"firebaseToken": firebaseToken}).networkResult!;
final String jwt = Login$Mutation.fromJson(qe.data!).login.jwtToken;
final Box box = await Hive.openBox('user');
box.put("jwt", jwt);
context.read().login(jwt);
if (!mounted) return;
Navigator.pop(context);
}