Firebase OTP was working but suddenly this error appears - flutter

I am trying to use firebase OTP verification
I get this error when sending firebase OTP it was working
but suddenly this error appears
E/FirebaseAuth(17209): [SmsRetrieverHelper] SMS verification code request failed: unknown status code: 17499 API key not valid. Please pass a valid API key.
E/flutter (17209): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String'
E/flutter (17209): #0 MethodChannelFirebaseAuth.verifyPhoneNumber.<anonymous closure> (package:firebase_auth_platform_interface/src/method_channel/method_channel_firebase_auth.dart:660:35)
E/flutter (17209): #1 _RootZone.runUnaryGuarded (dart:async/zone.dart:1586:10)
E/flutter (17209): #2 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (17209): #3 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter (17209): #4 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
E/flutter (17209): #5 _HandleErrorStream._handleData (dart:async/stream_pipe.dart:253:10)
E/flutter (17209): #6 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
E/flutter (17209): #7 _RootZone.runUnaryGuarded (dart:async/zone.dart:1586:10)
E/flutter (17209): #8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (17209): #9 _DelayedData.perform (dart:async/stream_impl.dart:515:14)
E/flutter (17209): #10 _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)
E/flutter (17209): #11 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)
E/flutter (17209): #12 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter (17209): #13 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
How to solve that ?

Related

I tried using carousel_slider in my flutter project, it works but I get this warning in my debug console. What can I do to eradicate this?

The error is coming from the package
The error is coming from line 135
This is the warning I get from my debug console
This happens as the carousel slides
E/flutter (13716): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Null
check operator used on a null value
E/flutter (13716): #0 CarouselSliderState.getTimer.<anonymous closure>
package:carousel_slider/carousel_slider.dart:135
E/flutter (13716): #1 _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter (13716): #2 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (13716): #3 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (13716): #4 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure>
(dart:async/zone.dart:1281:26)
E/flutter (13716): #5 _rootRunUnary (dart:async/zone.dart:1444:13)
E/flutter (13716): #6 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (13716): #7 _CustomZone.bindUnaryCallback.<anonymous closure>
(dart:async/zone.dart:1265:26)
E/flutter (13716): #8 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (13716): #9 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (13716): #10 _RawReceivePortImpl._handleMessage (dart:isolate-
patch/isolate_patch.dart:192:12)
E/flutter (13716):
According to the error and the screenshot, either carouselState, pageController or page is null, and you are using null check operator (!) to say that these variables can not be null. You can check these variables if they are null or not. Or you can use nullable operator (?) instead of null check operator (!).

image upload using http multipart. if image is null then getting error

on tap submit subbmit method call .
[1]: https://i.stack.imgur.com/glYah.png
error :
successful
E/flutter (11575): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: NoSuchMethodError: The method 'readAsBytesSync' was called on null.
E/flutter (11575): Receiver: null
E/flutter (11575): Tried calling: readAsBytesSync()
E/flutter (11575): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
E/flutter (11575): #1 _Delivery_DetailsState.submitForm (package:shop_me/src/screens/product_delivery/ui/delivery_detail.dart:500:37)
E/flutter (11575): #2 _Delivery_DetailsState.build. (package:shop_me/src/screens/product_delivery/ui/delivery_detail.dart:384:33)
E/flutter (11575): #3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21)
E/flutter (11575): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (11575): #5 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:607:11)
E/flutter (11575): #6 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5)
E/flutter (11575): #7 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267:7)
E/flutter (11575): #8 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27)
E/flutter (11575): #9 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:443:20)
E/flutter (11575): #10 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
E/flutter (11575): #11 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:287:11)
E/flutter (11575): #12 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
E/flutter (11575): #13 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
E/flutter (11575): #14 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
E/flutter (11575): #15 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
E/flutter (11575): #16 _rootRunUnary (dart:async/zone.dart:1370:13)
E/flutter (11575): #17 _CustomZone.runUnary (dart:async/zone.dart:1265:19)
E/flutter (11575): #18 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
E/flutter (11575): #19 _invoke1 (dart:ui/hooks.dart:182:10)
E/flutter (11575): #20 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282:7)
E/flutter (11575): #21 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
E/flutter (11575):

Not able to login with a Google email in Flutter

I'm trying to login in Flutter and this is the error I'm getting when I try to login with a Google email:
E/flutter (26329): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method '[]' was called on null.
`enter code here`E/flutter (26329): Receiver: null
E/flutter (26329): Tried calling: []("email")
E/flutter (26329): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
E/flutter (26329): #1 DocumentSnapshot.[] (package:cloud_firestore/src/document_snapshot.dart:29:42)
E/flutter (26329): #2 new User.fromDocument (package:buddiesgram/models/user.dart:23:17)
E/flutter (26329): #3 _HomePageState.saveUserInfoFirestore (package:buddiesgram/pages/HomePage.dart:83:26)
E/flutter (26329): <asynchronous suspension>
E/flutter (26329): #4 _HomePageState.controlSignIn (package:buddiesgram/pages/HomePage.dart:54:13)
E/flutter (26329): #5 _HomePageState.initState.<anonymous closure> (package:buddiesgram/pages/HomePage.dart:40:9)
E/flutter (26329): #6 _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter (26329): #7 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (26329): #8 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter (26329): #9 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (26329): #10 _DelayedData.perform (dart:async/stream_impl.dart:594:14)
E/flutter (26329): #11 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:710:11)
E/flutter (26329): #12 _PendingEvents.schedule.<anonymous closure> *emphasized text*(dart:async/stream_impl.dart:670:7)
E/flutter (26329): #13 _rootRun (dart:async/zone.dart:1180:38)
E/flutter (26329): #14 _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (26329): #15 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (26329): #16 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)`**`*enter code here*`**`
E/flutter (26329): #17 _rootRun (dart:async/zone.dart:1184:13)
E/flutter (26329): #18 _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (26329): #19 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (26329): #20 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter (26329): #21 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter (26329): #22 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
E/flutter (26329):
What am I missing?
Please include a code snippet of what you are trying to do
In my understanding of your stackTrace you are trying to call list on a null object like this:
final UserData userData = someObjectHere;
function login(UserData userData){
//The problem is that userData might be null which causes your issue
String email = userData[]("Email");
}
You're solution might be to use null aware operators or to manually check whether the object you're calling a method on is not null.
String email = userData?.[]("Email");
or
if(userData != null) String email = userData?.[]("Email");

Error while using games_services plugin: Unhandled Exception: PlatformException(error, 4: 4: , null)

I wanted to use google play services in my flutter application for which i used games_services plugin. I followed all the steps in this medium post. But it still gave me this error.
E/flutter (27643): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, 4: 4: , null)
E/flutter (27643): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569)
E/flutter (27643): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321)
E/flutter (27643): <asynchronous suspension>
E/flutter (27643): #2 GamesServices.signIn (package:games_services/games_services.dart:52)
E/flutter (27643): #3 _WelcomePageState.build.<anonymous closure> (package:quizbee/pages/home/welcome.dart:182)
E/flutter (27643): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706)
E/flutter (27643): #5 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:789)
E/flutter (27643): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182)
E/flutter (27643): #7 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486)
E/flutter (27643): #8 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:282)
E/flutter (27643): #9 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:199)
E/flutter (27643): #10 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:467)
E/flutter (27643): #11 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76)
E/flutter (27643): #12 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:117)
E/flutter (27643): #13 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379)
E/flutter (27643): #14 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:115)
E/flutter (27643): #15 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101)
E/flutter (27643): #16 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218)
E/flutter (27643): #17 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198)
E/flutter (27643): #18 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156)
E/flutter (27643): #19 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102)
E/flutter (27643): #20 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86)
E/flutter (27643): #21 _rootRunUnary (dart:async/zone.dart:1138)
E/flutter (27643): #22 _CustomZone.runUnary (dart:async/zone.dart:1031)
E/flutter (27643): #23 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933)
E/flutter (27643): #24 _invoke1 (dart:ui/hooks.dart:273)
E/flutter (27643): #25 _dispatchPointerDataPacket (dart:ui/hooks.dart:182)
Thank You in advance.

Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index' flutter new

I am not getting output on my app and it should have give a output like many question is how to sisplay json data in my flutter app
class AppState extends State<AppName>{
var name ;
var email ;
int cgpa ;
TextEditingController user = new TextEditingController();
String url = 'http://10.42.0.243:8000/students/';
getData(String username) async{
String profile = url+'?search='+username;
var res = await http.get(profile,headers: {"Accept":"application/json"});
print(res.body);
debugPrint(res.body);
var resBody = json.decode(res.body);
name = resBody['sname'].toString();
email = resBody['email'].toString();
cgpa = resBody['cgpa'] ;
debugPrint(name);
setState(() {
print("Success");
});
}
my app screenshot is
JSON Data Screenshot
Error output:
Performing hot reload...
Syncing files to device Moto G 5 Plus...
Reloaded 0 of 576 libraries in 389ms.
E/BpSurfaceComposerClient(28411): Failed to transact (-1)
E/BpSurfaceComposerClient(28411): Failed to transact (-1)
I/flutter (28411): [{"id":1,"sname":"Ashutosh Lokhande","email":"2016bit053#sggs.ac.in","year":"2016","cgpa":7.2}]
I/flutter (28411): [{"id":1,"sname":"Ashutosh Lokhande","email":"2016bit053#sggs.ac.in","year":"2016","cgpa":7.2}]
E/flutter (28411): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index'
E/flutter (28411): #0 AppState.getData (package:json_flutter/main.dart:28:19)
E/flutter (28411):
E/flutter (28411): #1 AppState.build. (package:json_flutter/main.dart:56:34)
E/flutter (28411): #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:654:14)
E/flutter (28411): #3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:729:32)
E/flutter (28411): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (28411): #5 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)
E/flutter (28411): #6 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:275:7)
E/flutter (28411): #7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:455:9)
E/flutter (28411): #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:75:13)
E/flutter (28411): #9 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:102:11)
E/flutter (28411): #10 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
E/flutter (28411): #11 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (28411): #12 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (28411): #13 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (28411): #14 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (28411): #15 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (28411): #16 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (28411): #17 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (28411): #18 _invoke1 (dart:ui/hooks.dart:263:10)
E/flutter (28411): #19 _dispatchPointerDataPacket (dart:ui/hooks.dart:172:5)
E/flutter (28411):