flutter zxing2 scanner example - flutter

Is there any working example for flutter Zxing2 pub package. I did tried the official pub package example [https://pub.dev/packages/zxing2/example | Dart Package] but it doesn’t work. I get the below error
I/CameraManagerGlobal( 5452): Connecting to camera service
E/flutter ( 5452): [ERROR:flutter/lib/ui/ui_dart_state.cc(213)] Unhandled Exception: CameraException(Uninitialized CameraController, startImageStream() was called on an uninitialized CameraController.)
E/flutter ( 5452): #0 CameraController._throwIfNotInitialized (package:camera/src/camera_controller.dart:769:7)
E/flutter ( 5452): #1 CameraController.startImageStream (package:camera/src/camera_controller.dart:370:5)
E/flutter ( 5452): #2 _MyHomePageState._onCameraSelected (package:test_camera/main.dart:83:26)
E/flutter ( 5452): #3 _MyHomePageState.initState (package:test_camera/main.dart:46:5)
E/flutter ( 5452): #4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4796:57)
E/flutter ( 5452): #5 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4631:5)
E/flutter ( 5452): #6 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #8 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6186:14)
E/flutter ( 5452): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #11 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4683:16)
E/flutter ( 5452): #12 Element.rebuild (package:flutter/src/widgets/framework.dart:4348:5)
E/flutter ( 5452): #13 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4636:5)
E/flutter ( 5452): #14 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4631:5)
E/flutter ( 5452): #15 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #16 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #17 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6186:14)
E/flutter ( 5452): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #20 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6186:14)
E/flutter ( 5452): #21 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #23 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4683:16)
E/flutter ( 5452): #24 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4831:11)
E/flutter ( 5452): #25 Element.rebuild (package:flutter/src/widgets/framework.dart:4348:5)
E/flutter ( 5452): #26 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4636:5)
E/flutter ( 5452): #27 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4822:11)
E/flutter ( 5452): #28 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4631:5)
E/flutter ( 5452): #29 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #30 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #31 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6186:14)
E/flutter ( 5452): #32 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #33 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #34 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6186:14)
E/flutter ( 5452): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #37 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4683:16)
E/flutter ( 5452): #38 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4831:11)
E/flutter ( 5452): #39 Element.rebuild (package:flutter/src/widgets/framework.dart:4348:5)
E/flutter ( 5452): #40 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4636:5)
E/flutter ( 5452): #41 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4822:11)
E/flutter ( 5452): #42 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4631:5)
E/flutter ( 5452): #43 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3666:14)
E/flutter ( 5452): #44 Element.updateChild (package:flutter/src/widgets/framework.dart:3418:18)
E/flutter ( 5452): #45 C
the code which throws error is on line 83.
Has anyone had the same issue? I will really appreciate if someone gives me a good working example to use zxing2.
Note: I only need to use zxing2 not qr or bar code scanner
thanks

I'v fixed this bug by adding call await controller.initialize();
before unawaited(controller.startImageStream((image) {
at _onCameraSelected method.
But this example does not contain usage of zxing2...

Related

My ListView Widget is not showing any data

In my code, i have a listview widget, and i gave data to it from firestore using firebase, and tried to display data on screen as text. But nothing happens, i am not getting any error or something. Still my page is blank. So can anyone tell me that is there a mistake in firebase part or listview one. It will be very helpfull.
Here's my code -
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:social_app/widgets/header.dart';
import 'package:social_app/widgets/progress.dart';
final userRef = FirebaseFirestore.instance.collection("users");
class Timeline extends StatefulWidget {
#override
_TimelineState createState() => _TimelineState();
}
class _TimelineState extends State<Timeline> {
List<dynamic> users = [];
#override
void initState() {
// TODO: implement initState
super.initState();
getUserById();
getUsers();
}
getUserById() {
}
getUsers() async {
final QuerySnapshot snapshot = await userRef.get();
setState(() {
users = snapshot.docs;
});
// snapshot.docs.forEach((DocumentSnapshot doc) {
// print(doc.data());
// print(doc.id);
// print(doc.exists);
// });
}
#override
Widget build(context) {
return SafeArea(
child: Scaffold(
backgroundColor: Colors.black,
appBar: header(context, isAppTitle: true),
body: Container(
child: ListView(
children: users.map((user) => Text(user['username'], style: TextStyle(color: Colors.white),)).toList()
),
),
),
);
}
}
Here's my run output -
Performing hot reload...
Syncing files to device sdk gphone x86...
Reloaded 3 of 800 libraries in 817ms.
W/Firestore( 3283): (21.7.1) [Firestore]: Listen for Query(target=Query(users order by __name__);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}
E/flutter ( 3283): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.
E/flutter ( 3283): #0 MethodChannelQuery.get (package:cloud_firestore_platform_interface/src/method_channel/method_channel_query.dart:105:7)
E/flutter ( 3283): <asynchronous suspension>
E/flutter ( 3283): #1 Query.get (package:cloud_firestore/src/query.dart:178:25)
E/flutter ( 3283): #2 _TimelineState.getUsers (package:social_app/pages/timeline.dart:29:50)
E/flutter ( 3283): #3 _TimelineState.initState (package:social_app/pages/timeline.dart:22:5)
E/flutter ( 3283): #4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4765:58)
E/flutter ( 3283): #5 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
E/flutter ( 3283): #6 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
E/flutter ( 3283): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
E/flutter ( 3283): #8 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14)
E/flutter ( 3283): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
E/flutter ( 3283): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
E/flutter ( 3283): #11 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14)
E/flutter ( 3283): #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
E/flutter ( 3283): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
E/flutter ( 3283): #14 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
E/flutter ( 3283): #15 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
E/flutter ( 3283): #16 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
E/flutter ( 3283): #17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
E/flutter ( 3283): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
E/flutter ( 3283): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
E/flutter ( 3283): #20 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
E/flutter ( 3283): #21 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
E/flutter ( 3283): #22 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
E/flutter ( 3283): #23 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
E/flutter ( 3283): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
E/flutter ( 3283): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
E/flutter ( 3283): #26 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
E/flutter ( 3283): #27 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11)
E/flutter ( 3283): #28 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
E/flutter ( 3283): #29 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
E/flutter ( 3283): #30 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4791:11)
E/flutter ( 3283): #31 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
E/flutter ( 3283): #32 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
E/flutter ( 3283): #33 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
E/flutter ( 3283): #34 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
E/flutter ( 3283): #35 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
E/flutter ( 3283): #36 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
E/flutter ( 3283): #37 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
E/flutter ( 3283): #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
E/flutter ( 3283): #39 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
E/flutter ( 3283): #40 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1158:36)
E/flutter ( 3283): #41 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1143:20)
E/flutter ( 3283): #42 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2683:19)
E/flutter ( 3283): #43 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1136:11)
E/flutter ( 3283): #44 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:350:23)
E/flutter ( 3283): #45 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1883:59)
E/flutter ( 3283): #46 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:915:15)
E/flutter ( 3283): #47 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1883:14)
E/flutter ( 3283): #48 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:339:5)
E/flutter ( 3283): #49 RenderSliverMultiBoxAdaptor.insertAndLayoutLeadingChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:455:5)
E/flutter ( 3283): #50 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:234:32)
E/flutter ( 3283): #51 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7)
E/flutter ( 3283): #52 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:132:12)
E/flutter ( 3283): #53 _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver_fill.dart:170:11)
E/flutter ( 3283): #54 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7)
E/flutter ( 3283): #55 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:507:13)
E/flutter ( 3283): #56 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1561:12)
E/flutter ( 3283): #57 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1470:20)
E/flutter ( 3283): #58 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1634:7)
E/flutter ( 3283): #59 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:884:18)
E/flutter ( 3283): #60 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:436:19)
E/flutter ( 3283): #61 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:914:13)
E/flutter ( 3283): #62 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:302:5)
E/flutter ( 3283): #63 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
E/flutter ( 3283): #64 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1055:9)
E/flutter ( 3283): #65 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:971:5)
E/flutter ( 3283): #66 _rootRun (dart:async/zone.dart:1190:13)
E/flutter ( 3283): #67 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 3283): #68 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 3283): #69 _invoke (dart:ui/hooks.dart:251:10)
E/flutter ( 3283): #70 _drawFrame (dart:ui/hooks.dart:209:3)
E/flutter ( 3283):
W/Firestore( 3283): (21.7.1) [WatchStream]: (a99c49e) Stream closed with status: Status{code=CANCELLED, description=Disconnecting idle stream. Timed out waiting for new targets., cause=null}.
W/ansh.social_ap( 3283): Accessing hidden method Ldalvik/system/CloseGuard;->close()V (greylist,core-platform-api, linking, allowed)
Your code seems to be working fine. Let me explain your problem.
When you create your cloud_firestore for the first time, then permission for accessing the data is set to public in the rules tab. This permission is public for 30 days. After that firestore turned it off and you have to define your own rule.
Here, rules are the actual permission which decide who can access your data and who cannot. Hence, for the time being you can again make the data public by changing the Rules.
Access the Rule tab by following the image below:
Change the Rules at firestore console accordingly. Here is the link to rules documentation.
Note:
You can make the Rules public for testing purposes but don't make it public permanently it will make your data insecure.

Unhandled Exception: type 'PlatformException' is not a subtype of type 'String'

Using Google sign in API for a month now
Getting this error before google sign-in
Changed Cloud Firestore Rules, still showing the same results
API error? (sign_in_failed, com.google.android.gms.common.api.ApiException: 10:, null)
E/flutter ( 8552): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: type 'PlatformException' is not a subtype of type 'String'
E/flutter ( 8552): #0 _SignInState.initState.<anonymous closure> (package:event_management/google_signin.dart:35:32)
E/flutter ( 8552): #1 _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 8552): #2 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 8552): #3 _FutureListener.handleError (dart:async/future_impl.dart:160:20)
E/flutter ( 8552): #4 Future._propagateToListeners.handleError (dart:async/future_impl.dart:708:47)
E/flutter ( 8552): #5 Future._propagateToListeners (dart:async/future_impl.dart:729:24)
E/flutter ( 8552): #6 Future._completeError (dart:async/future_impl.dart:537:5)
E/flutter ( 8552): #7 _AsyncAwaitCompleter.completeError (dart:async-patch/async_patch.dart:47:15)
E/flutter ( 8552): #8 GoogleSignIn.signInSilently (package:google_sign_in/google_sign_in.dart)
E/flutter ( 8552): <asynchronous suspension>
E/flutter ( 8552): #9 _SignInState.initState (package:event_management/google_signin.dart:32:13)
E/flutter ( 8552): #10 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4684:58)
E/flutter ( 8552): #11 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
E/flutter ( 8552): #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #14 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #15 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #16 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #17 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
E/flutter ( 8552): #18 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
E/flutter ( 8552): #19 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4525:5)
E/flutter ( 8552): #20 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
E/flutter ( 8552): #21 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #23 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #26 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #29 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
E/flutter ( 8552): #30 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
E/flutter ( 8552): #31 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
E/flutter ( 8552): #32 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4525:5)
E/flutter ( 8552): #33 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4710:11)
E/flutter ( 8552): #34 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
E/flutter ( 8552): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #37 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #39 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #40 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #41 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #42 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #43 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
E/flutter ( 8552): #44 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
E/flutter ( 8552): #45 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
E/flutter ( 8552): #46 ComponentElement._firstBuild (package
Cloud Firestore Rules:
`
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.time < timestamp.date(2020, 8, 31);
}
}
}
`
Cause:
This Problem occured as I had re-installed Android Studio in my external ssd, so SHA-1 values changed.
Solution:
Get SHA-1 again using "gradlew signingReport" command in gradlew terminal.
Add new SHA-1 value into the Firebase, it might solve your issue.

Flutter Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111

I'm attempting to get a flutter app, made in android studio, to connect to a c# api hosted locally. Running the api on IIS Express gives a url of https://localhost:44364/api/trip, which I believe relates to http://10.0.2.2:44364/api in Android studio when using the emulator.
I'm attempting to retrieve a list of Trips from the db via API. Postman works fine.
I get multiple errors. I have tried the emulator, I've also tried plugging a phone in directly and switching the address to my ip address. I've even tried switching the api to run in the console and not IIS. Nothing works.
I did attempt to reach the api through the emulator browser and was told the site was unsafe, leading me to think it's a certificate problem.
The flutter project is fairly simple, it's in its infancy stage and I'm still learning how to program it.
Here are the three flutter files, and the error list.
main.dart
import 'dart:convert';
import 'package:bike_client/API.dart';
import 'package:bike_client/models/Trip.dart';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Track It',
theme: new ThemeData(
primarySwatch: Colors.red,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
#override
createState() => new _MyHomePageState();
}
class _MyHomePageState extends State {
var trips = new List<Trip>();
_getTrips() {
API.getTrips().then((response) {
setState(() {
Iterable list = json.decode(response.body);
trips = list.map((model) => Trip.fromJson(model)).toList();
});
});
}
initState() {
super.initState();
_getTrips();
}
dispose() {
super.dispose();
}
#override
build(context) {
return Scaffold(
appBar: AppBar(
title: Text("Trip List"),
),
body: ListView.builder(
itemCount: trips.length,
itemBuilder: (context, index) {
return ListTile(title: Text((trips[index].tripId).toString()));
},
));
}
}
API.dart
import 'dart:async';
import 'package:http/http.dart' as http;
//const baseUrl = "https://192.168.1.14:44364/api";
const baseUrl = "http://10.0.2.2:44364/api";
class API {
static Future getTrips() {
var url = baseUrl + "/trip/1";
return http.get(url);
}
}
Trip.dart
class Trip {
int tripId;
int userId;
Trip(int tripId, int userId) {
this.tripId = tripId;
this.userId = userId;
}
Trip.fromJson(Map json)
: tripId = json['tripId'],
userId = json['userId'];
Map toJson() {
return {'tripId': tripId, 'userId': userId};
}
}
Console
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
E/flutter ( 7781): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 38612
E/flutter ( 7781): #0 IOClient.send (package:http/src/io_client.dart:33:24)
E/flutter ( 7781): <asynchronous suspension>
E/flutter ( 7781): #1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:176:38)
E/flutter ( 7781): #2 BaseClient.get (package:http/src/base_client.dart:35:7)
E/flutter ( 7781): #3 get.<anonymous closure> (package:http/http.dart:46:36)
E/flutter ( 7781): #4 _withClient (package:http/http.dart:166:20)
E/flutter ( 7781): #5 get (package:http/http.dart:46:5)
E/flutter ( 7781): #6 API.getTrips (package:bike_client/API.dart:9:12)
E/flutter ( 7781): #7 _MyHomePageState._getTrips (package:bike_client/main.dart:30:9)
E/flutter ( 7781): #8 _MyHomePageState.initState (package:bike_client/main.dart:40:5)
E/flutter ( 7781): #9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
E/flutter ( 7781): #10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #12 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #13 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #14 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #16 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #17 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #18 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #19 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #22 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #25 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #27 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #28 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #29 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #30 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #31 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
E/flutter ( 7781): #32 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #33 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #35 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #37 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #38 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #39 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #41 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #42 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #43 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #44 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
E/flutter ( 7781): #45 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #46 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #47 Element.updateChild (package:flutter/src/wid
E/flutter ( 7781): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 38760
E/flutter ( 7781): #0 IOClient.send (package:http/src/io_client.dart:33:24)
E/flutter ( 7781): <asynchronous suspension>
E/flutter ( 7781): #1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:176:38)
E/flutter ( 7781): #2 BaseClient.get (package:http/src/base_client.dart:35:7)
E/flutter ( 7781): #3 get.<anonymous closure> (package:http/http.dart:46:36)
E/flutter ( 7781): #4 _withClient (package:http/http.dart:166:20)
E/flutter ( 7781): #5 get (package:http/http.dart:46:5)
E/flutter ( 7781): #6 API.getTrips (package:bike_client/API.dart:9:12)
E/flutter ( 7781): #7 _MyHomePageState._getTrips (package:bike_client/main.dart:30:9)
E/flutter ( 7781): #8 _MyHomePageState.initState (package:bike_client/main.dart:40:5)
E/flutter ( 7781): #9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
E/flutter ( 7781): #10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #12 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #13 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #14 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #16 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #17 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #18 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #19 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #22 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #25 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #27 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #28 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #29 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #30 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #31 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
E/flutter ( 7781): #32 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #33 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #35 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #37 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #38 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #39 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #41 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #42 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #43 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #44 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
E/flutter ( 7781): #45 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #46 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #47 Element.updateChild (package:flutter/src/wid
E/flutter ( 7781): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 38884
E/flutter ( 7781): #0 IOClient.send (package:http/src/io_client.dart:33:24)
E/flutter ( 7781): <asynchronous suspension>
E/flutter ( 7781): #1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:176:38)
E/flutter ( 7781): #2 BaseClient.get (package:http/src/base_client.dart:35:7)
E/flutter ( 7781): #3 get.<anonymous closure> (package:http/http.dart:46:36)
E/flutter ( 7781): #4 _withClient (package:http/http.dart:166:20)
E/flutter ( 7781): #5 get (package:http/http.dart:46:5)
E/flutter ( 7781): #6 API.getTrips (package:bike_client/API.dart:9:12)
E/flutter ( 7781): #7 _MyHomePageState._getTrips (package:bike_client/main.dart:30:9)
E/flutter ( 7781): #8 _MyHomePageState.initState (package:bike_client/main.dart:40:5)
E/flutter ( 7781): #9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
E/flutter ( 7781): #10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #12 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #13 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #14 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #16 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #17 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #18 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #19 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #22 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #25 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #27 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #28 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #29 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #30 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #31 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
E/flutter ( 7781): #32 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #33 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #35 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #37 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #38 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
E/flutter ( 7781): #39 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 7781): #41 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
E/flutter ( 7781): #42 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
E/flutter ( 7781): #43 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
E/flutter ( 7781): #44 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
E/flutter ( 7781): #45 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 7781): #46 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 7781): #47 Element.updateChild (package:flutter/src/wid
E/flutter ( 7781): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: SocketException:
AND MUCH MORE!
This error occurs mostly when your android AVD or android device is not connected to internet. Sometimes, the developer tries to access plugin on localhost from android device instead of AVD, in such cases, same error occurs. I hope this solves your problem.
Other scenarios involves port blocked by firewalls on serverside.
Kindly upvote if you find my answer usable.
Learn Cybers
If you use the emulator with localhost. please change the IP address from 127.0.0.1 to 10.0.2.2 in API urls.
to avoid the following problems:
write failed
connection closed before ...
Flutter Doctor Error - SocketException: Write failed (OS Error: Broken pipe, errno = 32)
you need to add the correct parameters in the headers.
In my case these problems occur with uploading images and sending base64 encoded requests.
I solved it by adding the following 'connection' header: 'keep-alive',
final response = await this.httpClient.put(
url,
encoding: Utf8Codec(),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Accept': "*/*",
'connection': 'keep-alive',
'Accept-Encoding' : 'gzip, deflate, br',
},
body: body,
);
it works for me
I had the same problem.
I've connencted my PC to my Phone hotspot, got my ip adress using "ipconfig" and made it as my base URL like this
"http://PC_IP_Adress:8000/api"

bug flare animation flutter

I have a bug with flare package.
I have a tab bar with 3 pages,
first tab I stack 3 flare animation. Specificity : for each initState I load the asset name with sharedpref to display the saved animation.
Second and third tab nothing special
When I slide tab 1 to 2 and 2 to 1 x Time , sometime I have crash only for this stack flare animation, not for others animation.
I load at the init of the tab1 the asset name saved previously:
asset_name_animation = prefs.getString('item' ) ?? "fond_vide";
I display the asset name loaded:
new Container (
width:400,
height: 400,
child: new FlareActor("assets/$asset_name_animation.flr",
alignment:Alignment.bottomCenter,
fit:BoxFit.contain,
animation: "Untitled"
)
),
Here is the error log:
E/flutter ( 9171): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Unable to load asset: assets/null.flr
E/flutter ( 9171): #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #1 FlareCacheAsset.load (package:flare_flutter/flare_cache_asset.dart:31:20)
E/flutter ( 9171): #2 Cache.getAsset (package:flare_flutter/cache.dart:56:15)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #3 cachedActor (package:flare_flutter/flare_cache.dart:35:16)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #4 FlareRenderBox.loadFlare (package:flare_flutter/flare_render_box.dart:322:35)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #5 FlareActorRenderObject.coldLoad (package:flare_flutter/flare_actor.dart:321:20)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #6 FlareRenderBox.load (package:flare_flutter/flare_render_box.dart:272:7)
E/flutter ( 9171): #7 FlareRenderBox.attach (package:flare_flutter/flare_render_box.dart:115:7)
E/flutter ( 9171): #8 AbstractNode.adoptChild (package:flutter/src/foundation/node.dart:132:13)
E/flutter ( 9171): #9 RenderObject.adoptChild (package:flutter/src/rendering/object.dart:1153:11)
E/flutter ( 9171): #10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin.child= (package:flutter/src/rendering/object.dart:2772:7)
E/flutter ( 9171): #11 SingleChildRenderObjectElement.insertChildRenderObject (package:flutter/src/widgets/framework.dart:5107:18)
E/flutter ( 9171): #12 RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:4951:35)
E/flutter ( 9171): #13 RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4717:5)
E/flutter ( 9171): #14 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #16 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
E/flutter ( 9171): #17 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #18 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #19 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
E/flutter ( 9171): #20 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 9171): #21 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
E/flutter ( 9171): #22 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
E/flutter ( 9171): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #25 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
E/flutter ( 9171): #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #27 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5198:32)
E/flutter ( 9171): #28 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #29 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #30 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
E/flutter ( 9171): #31 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 9171): #32 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
E/flutter ( 9171): #33 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
E/flutter ( 9171): #34 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #35 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #36 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
E/flutter ( 9171): #37 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #38 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #39 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
E/flutter ( 9171): #40 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 9171): #41 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
E/flutter ( 9171): #42 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
E/flutter ( 9171): #43 ParentDataElement.mount (package:flutter/src/widgets/framework.dart:4279:11)
E/flutter ( 9171): #44 Element.inflateWidget (pac
I have an other crash who is repetable and have same animation issue : all time when I launch a route => back => slide tab 2 => slide tab 1, I have this error and animation crash.
E/flutter ( 9171): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
E/flutter ( 9171): At this point the state of the widget's element tree is no longer stable.
E/flutter ( 9171): To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling inheritFromWidgetOfExactType() in the widget's didChangeDependencies() method.
E/flutter ( 9171): #0 Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure> (package:flutter/src/widgets/framework.dart:3389:9)
E/flutter ( 9171): #1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:3403:6)
E/flutter ( 9171): #2 Element.inheritFromWidgetOfExactType (package:flutter/src/widgets/framework.dart:3418:12)
E/flutter ( 9171): #3 TickerMode.of (package:flutter/src/widgets/ticker_provider.dart:52:39)
E/flutter ( 9171): #4 _analyse2State&State&WidgetsBindingObserver&TickerProviderStateMixin.didChangeDependencies (package:flutter/src/widgets/ticker_provider.dart:197:36)
E/flutter ( 9171): #5 analyse2State.didChangeDependencies (package:ouiquit_app/tableau_de_bord.dart:5533:11)
E/flutter ( 9171): #6 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:77:64)
E/flutter ( 9171): #7 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 9171): #8 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 9171): #9 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter ( 9171): #10 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter ( 9171): #11 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter ( 9171): #12 Future._complete (dart:async/future_impl.dart:473:7)
E/flutter ( 9171): #13 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 9171): #14 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
E/flutter ( 9171): #15 _rootRun (dart:async/zone.dart:1120:38)
E/flutter ( 9171): #16 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 9171): #17 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 9171): #18 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 9171): #19 _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 9171): #20 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 9171): #21 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 9171): #22 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 9171): #23 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 9171): #24 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter ( 9171):
Even though I had this error but after few seconds the animation went alive
and it shows no lag at all
try doing flutter clean

No working audio_service and firebase_messaging together

In my project audio_service and firebase_messaging not working together.
Error message is:
E/flutter ( 5794): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'void com.ryanheise.audioservice.AudioServicePlugin$BackgroundHandler.init(io.flutter.plugin.common.PluginRegistry$Registrar)' on a null object reference, null) E/flutter ( 5794): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7) E/flutter ( 5794): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33) E/flutter ( 5794): E/flutter ( 5794): #2 FirebaseMessaging.configure (package:firebase_messaging/firebase_messaging.dart:118:16) E/flutter ( 5794): #4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4334:27) E/flutter ( 5794): #5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15) E/flutter ( 5794): #6 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) E/flutter ( 5794): #7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) E/flutter ( 5794): #8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) E/flutter ( 5794): #9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) E/flutter ( 5794): #10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #11 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #12 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) E/flutter ( 5794): #13 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #14 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #15 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) E/flutter ( 5794): #16 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) E/flutter ( 5794): #17 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) E/flutter ( 5794): #18 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) E/flutter ( 5794): #19 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #20 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #21 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) E/flutter ( 5794): #22 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #23 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #24 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) E/flutter ( 5794): #25 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #26 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #27 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) E/flutter ( 5794): #28 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) E/flutter ( 5794): #29 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) E/flutter ( 5794): #30 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) E/flutter ( 5794): #31 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) E/flutter ( 5794): #32 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #33 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #34 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) E/flutter ( 5794): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #37 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) E/flutter ( 5794): #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) E/flutter ( 5794): #39 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) E/flutter ( 5794): #40 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) E/flutter ( 5794): #41 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) E/flutter ( 5794): #42 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) E/flutter ( 5794): #43 StatefulElement._firs E/flutter ( 5794): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method FcmDartService#initialized on channel plugins.flutter.io/firebase_messaging_background) E/flutter ( 5794): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7) E/flutter ( 5794): E/flutter ( 5794): #1 _fcmSetupBackgroundChannel (package:firebase_messaging/firebase_messaging.dart:50:21) E/flutter ( 5794): #2 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:45:6) E/flutter ( 5794): #3 _fcmSetupBackgroundChannel (package:firebase_messaging/firebase_messaging.dart:23:32) E/flutter ( 5794): #4 _runMainZoned.. (dart:ui/hooks.dart:239:25) E/flutter ( 5794): #5 _rootRun (dart:async/zone.dart:1126:13) E/flutter ( 5794): #6 _CustomZone.run (dart:async/zone.dart:1023:19) E/flutter ( 5794): #7 _runZoned (dart:async/zone.dart:1518:10) E/flutter ( 5794): #8 runZoned (dart:async/zone.dart:1502:12) E/flutter ( 5794): #9 _runMainZoned. (dart:ui/hooks.dart:231:5) E/flutter ( 5794): #10 _startIsolate. (dart:isolate-patch/isolate_patch.dart:307:19) E/flutter ( 5794): #11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)*
Someone has any idea about this error?
Thanks!