Flutter, The element type 'List<ListTile>' can't be assigned to the list type 'Widget'

Advertisements I tried geting data from firebase and display it using streamBuilder but I get this error, how do I solve it. body: StreamBuilder<QuerySnapshot>( stream: firestore.collection(‘paymnet data’).snapshots(), builder: (context, snapshot) { return ListView( children: [ snapshot.data!.docs.map((DocumentSnapshot document){ Map<String,dynamic> data = document.data()! as Map<String, dynamic>; return ListTile( title: Text(data[‘amount’]), subtitle: Text(data[‘paid date’]), ); }).toList(); ], );… Read More Flutter, The element type 'List<ListTile>' can't be assigned to the list type 'Widget'

Flutter error: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>

Advertisements Hi I am getting this error Though this error has been asked by multiple people but I cannot seem to address this in my scenario How do I correct this error I cannot seem to comprehend how to solve this Here is the code: child:FutureBuilder<List<Articles>>( future: fetchApiData(), builder: (context, snapshot) { if (snapshot.hasData) {… Read More Flutter error: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>

The argument type 'Future<List<dynamic>>' can't be assigned to the parameter type 'Future<List<ModelClass>>?'

Advertisements I am getting this error I cannot seem to get what I am doing wrong please help. I am fetching the data through a rest api Here is the code: FutureBuilder<List<Articles>>( future: fetchApiData(), builder: (context, snapshot) { if (snapshot.hasData) { return ListView.separated( itemBuilder: (context, index) { Articles articles = snapshot.data![index]; const SizedBox(height: 150,); return… Read More The argument type 'Future<List<dynamic>>' can't be assigned to the parameter type 'Future<List<ModelClass>>?'

Uncaught (in promise) FirebaseError: No document to update

Advertisements I made a firestore database that looks like this. I’m trying to make "stocks : 999" value change, so that it can be 998, 997, etc… So I followed given instructions on firebase documentation (https://firebase.google.com/docs/firestore/manage-data/add-data#web-version-9_8), but I bump into an error when trying to make it work. const [stock, SetStock] = useState([]); const toUpdate… Read More Uncaught (in promise) FirebaseError: No document to update

Returning counting result from Firebase Query

Advertisements I try to get the amount of rows in my Firebase. But is says cannot find counter in scope on line return counter. extension FourthTabFirstView: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { let ref = database.child("placeID") ref.observe(.value, with: { (snapshot: DataSnapshot!) in print(snapshot.childrenCount) let counter = snapshot.childrenCount }) return… Read More Returning counting result from Firebase Query

A pending promise is returned from stripe.checkout.sessions.listLineItems each time

Advertisements Here I am trying to get the data from the firebase and then use that id to retrieve items from stripe checkout. But each time I try this I get a pending promise. const colRef = collection(db, `users/${session.user.email}/orders`); const q = query(colRef, orderBy("timestamp", "desc")); const orders = await getDocs(q) .then((snapshot) => { snapshot.docs.forEach((sdoc) =>… Read More A pending promise is returned from stripe.checkout.sessions.listLineItems each time

Flutter – A non-null value must be returned since the return type 'Widget' doesn't allow null

Advertisements I tried to run this code but it gives me the error provided in the title, also it says (The body might complete normally, causing ‘null’ to be returned, but the return type, ‘Widget’, is a potentially non-nullable type.), any help to solve this issue would be appreciated! Widget build(BuildContext context) { return StreamBuilder<QuerySnapshot>(… Read More Flutter – A non-null value must be returned since the return type 'Widget' doesn't allow null

Flutter Map<String, dynamic>: Issues to get data from Firestore

Advertisements I’m trying the get data from Firestore but I have a issues on Map<String, dynamics>. Any idea how to fix this issues? final QuerySnapshot result = await firestore.collection(‘markers’).get(); final List<DocumentSnapshot> documents = result.docs; int count = 0; documents.forEach((data) { Map<String, dynamic> datos = data.data; GeoPoint tmp = datos[‘position’]; if (count < int.parse(data.id)) count =… Read More Flutter Map<String, dynamic>: Issues to get data from Firestore