Error: Too many positional arguments: 1 allowed, but 2 found

I’m working on a flutter app that is getting a JSON from an API, then I’m parsing the JSON and building a List Tile, when I try to run the code, I’m getting this error. lib/screens/screen4.dart:112:23: Error: Too many positional arguments: 1 allowed, but 2 found. Try removing the extra positional arguments. return _tile(data[index].ssid,data[index].auth,icon: Icons.wifi);… Read More Error: Too many positional arguments: 1 allowed, but 2 found

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

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 – A non-null value must be returned since the return type 'Widget' doesn't allow null

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>( stream:… Read More Flutter – A non-null value must be returned since the return type 'Widget' doesn't allow null

Flutter function that returns conditional does not give correct result

I have a code like this: //… child: ListTile( leading: CircleAvatar( backgroundImage: NetworkImage("${snapshot.data!.docs[index].data()[‘urunFotografi’]}"), ), title: Text(snapshot.data!.docs[index].data()["urunAdi"], style: TextStyle(fontSize: 20),), subtitle: Text(adetVeyaKilo().toString(), style: TextStyle(fontSize: 15),), ), // … // … Future<String> adetVeyaKilo() async { String state = ""; FirebaseFirestore.instance.collection(‘bolatAktar’).where(‘urunAdi’, isEqualTo: urunAdi).get().then((value) { value.docs.forEach((element) { if (element.data()["urunBirimi"] == "Adet") { state = "Adet"; } if (element.data()["urunBirimi"] ==… Read More Flutter function that returns conditional does not give correct result

Flutter Listview.Builder inside bottom sheet widget not loading data on load

The below code does not display any data when the bottomsheet loads. Once the bottomsheet is loaded if I do a save operation on the code editor it loads the data. What am I missing here? I have a bottomsheet widget which is invoked using a button. _showBottomSheet() { showModalBottomSheet( context: context, builder: (context) {… Read More Flutter Listview.Builder inside bottom sheet widget not loading data on load

Multiple cards inside a list widget in flutter

I am a beginner in Flutter and i am creating an demo application but in that application I want to add another card in the list widget(code is mentioned below) but somehow it shows an error. import ‘package:flutter/cupertino.dart’; import ‘package:flutter/material.dart’; class Intro extends StatefulWidget { const Intro({Key? key}) : super(key: key); @override _IntroState createState() =>… Read More Multiple cards inside a list widget in flutter

How to change multiple listtile color on click on toggle button in flutter

I want to change the color of ListTile when toggle button is on, this is happening, but I can’t do this for multiple ListTiles wherease i can on the toggle button for multiple listTile. Here is my code late int tappedIndex; @override void initState() { super.initState(); tappedIndex = 0; } Expanded( child: ListView.builder( itemCount: books.length,… Read More How to change multiple listtile color on click on toggle button in flutter