title: firebase phone number authentication is not working Unhandled Exception: PlatformException(error, null reference, null)
body: <p>note: my both loginpage class and otpscreen class are statefulwidget i just avoid the extra code to  show here.</p>
  
  <p>i am trying to authenticate phone number. otp message is coming but not verfying after clicking the submit button here is the error i get</p>
  
  <pre><code>E/flutter (21679): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, null reference, null)
  E/flutter (21679): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
  E/flutter (21679): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
  E/flutter (21679): &lt;asynchronous suspension&gt;
  E/flutter (21679): #2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:349:48)
  E/flutter (21679): #3      MethodChannelFirebaseAuth.signInWithCredential (package:firebase_auth_platform_interface/src/method_channel_firebase_auth.dart:161:23)
  E/flutter (21679): #4      FirebaseAuth.signInWithCredential (package:firebase_auth/src/firebase_auth.dart:208:10)
  E/flutter (21679): #5      LoginRepository.signIn (package:doorstep/domain/repository/login-repository.dart:36:17)
  E/flutter (21679): #6      OtpScreenState.submit.&lt;anonymous closure&gt; (package:doorstep/module/login/otpscreen.dart:90:26)
  E/flutter (21679): #7      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
  E/flutter (21679): #8      _InkResponseState.build.&lt;anonymous closure&gt; (package:flutter/src/material/ink_well.dart:789:36)
  E/flutter (21679): #9      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
  E/flutter (21679): #10     TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
  E/flutter (21679): #11     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
  E/flutter (21679): #12     BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:199:7)
  E/flutter (21679): #13     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:467:9)
  E/flutter (21679): #14     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12)
  E/flutter (21679): #15     PointerRouter._dispatchEventToRoutes.&lt;anonymous closure&gt; (package:flutter/src/gestures/pointer_router.dart:117:9)
  E/flutter (21679): #16     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
  E/flutter (21679): #17     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:115:18)
  E/flutter (21679): #18     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:7)
  E/flutter (21679): #19     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
  E/flutter (21679): #20     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
  E/flutter (21679): #21     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
  E/flutter (21679): #22     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
  E/flutter (21679): #23     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
  E/flutter (21679): #24     _rootRunUnary (dart:async/zone.dart:1138:13)
  E/flutter (21679): #25     _CustomZone.runUnary (dart:async/zone.dart:1031:19)
  E/flutter (21679): #26     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
  E/flutter (21679): #27     _invoke1 (dart:ui/hooks.dart:273:10)
  E/flutter (21679): #28     _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
  </code></pre>
  
  <p>This is loginrepository</p>
  
  <pre><code>class LoginRepository{
  
    String verificationId;
    var _auth = FirebaseAuth.instance;
  
    Future&lt;void&gt; sendOtp(String _number) async {
      final PhoneVerificationCompleted phoneVerificationCompleted =
          (AuthCredential credential) {};
      final PhoneVerificationFailed phoneVerificationFailed =
          (AuthException exception) {
        print("Login Faild due to $exception");
      };
      final PhoneCodeSent phoneCodeSent =
          (String verificationId, [int forceResendingToken]) {
        this.verificationId = verificationId;
      };
      final PhoneCodeAutoRetrievalTimeout phoneCodeAutoRetrievalTimeout =
          (String verificationId) {
        this.verificationId = verificationId;
        print("time out");
      };
      await _auth.verifyPhoneNumber(
          phoneNumber: _number,
          timeout: Duration(seconds: 120),
          verificationCompleted: phoneVerificationCompleted,
          verificationFailed: phoneVerificationFailed,
          codeSent: phoneCodeSent,
          codeAutoRetrievalTimeout: phoneCodeAutoRetrievalTimeout);
    }
  
    Future&lt;void&gt; signIn(String otpCode) async {
      final AuthCredential authCredential = PhoneAuthProvider.getCredential(
          verificationId: verificationId, smsCode: otpCode);
      await _auth.signInWithCredential(authCredential);
    }
  }
  </code></pre>
  
  <p>this is loginpage class </p>
  
  <pre><code>class LoginPage{
  LoginRepository _loginRepository = LoginRepository();
    Widget send() {
      return FlatButton(
        child: Text("Send OTP"),
        onPressed: () {
          _loginRepository.sendOtp(_numberController.text);
        },
      );
    }
  }
  </code></pre>
  
  <p>this is otp class</p>
  
  <pre><code>    class OtpScreen{
    LoginRepository _loginRepository = LoginRepository();
    Widget submit() {
      return FlatButton(
        child: Text("Submit"),
        onPressed: () async {
          _loginRepository.signIn(_otpController.text);
        },
      );
    }
  }
  </code></pre>