'flutter waning schedule binding while using listview builder
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
class Bookings extends StatefulWidget {
const Bookings({Key? key}) : super(key: key);
@override
State<Bookings> createState() => _BookingsState();
}
class _BookingsState extends State<Bookings> {
final String auth = FirebaseAuth.instance.currentUser!.uid;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.red[200],
body: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection("Bookings").where('UserID',isEqualTo: "$auth").snapshots(),
builder: (context,snapshot){
if(snapshot.hasError){
return Text("Something Went Wrong");
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(
color: Colors.redAccent,
),
);
}
if(snapshot.hasData){
final data = snapshot.requireData;
var len = snapshot.data!.size;
return ListView.builder(
itemCount: data.size,
itemBuilder: (BuildContext context, int index){
return Card(
elevation: 4,
child: ListTile(
leading: Container(
child: Image.network(image(data,index)),
),
title: Text("${data.docs[index]["Place"]}",
style: TextStyle(
fontSize: 20,
),
),
),
);
});
}
else{
return Text("sdf");
}
},
)
);
}
String image(data,index){
final img = FirebaseFirestore.instance.collection("Places").where('Name',isEqualTo: "${data.docs[index]["Place"]}").snapshots();
print(img);
return img.toString();
}
}
The error is /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/snackbar/snackbar.dart:452:22: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance!.addPostFrameCallback( ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/router_report.dart:53:22: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance!.addPostFrameCallback((_) { ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/simple/get_controllers.dart:90:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance!.addObserver(this); ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/simple/get_controllers.dart:96:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance!.removeObserver(this); ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/rx_flutter/rx_notifier.dart:130:22: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance?.addPostFrameCallback((_) => onReady()); ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/rx_flutter/rx_disposable.dart:20:22: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance?.addPostFrameCallback((_) => onReady()); ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/extension_navigation.dart:357:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance!.addPostFrameCallback((_) { ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/extension_navigation.dart:468:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/src/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance!.addPostFrameCallback((_) { ^ Restarted application in 2,457ms. W/DynamiteModule(30694): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found. E/Parcel (30694): Reading a NULL string not supported here. I/DynamiteModule(30694): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0 W/ProviderInstaller(30694): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0. I/System.out(30694): [socket]:check permission begin! E/flutter (30694): [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: Null check operator used on a null value, stack trace: #0 StatefulElement.state (package:flutter/src/widgets/framework.dart:4925:44) E/flutter (30694): #1 Navigator.of (package:flutter/src/widgets/navigator.dart:2542:47) E/flutter (30694): #2 Navigator.pushReplacement (package:flutter/src/widgets/navigator.dart:2103:22) E/flutter (30694): #3 _LoadingState.build. (package:tourism_app/screens/loading.dart:17:17) E/flutter (30694): #4 new Future.delayed. (dart:async/future.dart:423:39) E/flutter (30694): #5 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) E/flutter (30694): #6 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) E/flutter (30694): #7 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) E/flutter (30694): #8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) E/flutter (30694):
Solution 1:[1]
It's something to do with the latest Flutter 3.0 update.
Try running dart fix --apply
to fix the app code but it won't fix issues in the packages you are using.
See if you can find the latest version for the packages you are using to check if the problem is solved.
Check this for more details.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |