All Questions
1,485 questions
0
votes
1
answer
49
views
there should be exactly one item with dropdownbutton 's value either zero or 2 or more [DropdownMenuItem]s were detected with the same value
I'm newbie with flutter, can someone help me ?
when I choose first dropdown, and choose the second dropdown, and then choose again the first dropdown, i get freeze error,
I'm already set the variable ...
2
votes
3
answers
66
views
I would like to modify the values of specific elements in a list in an efficient manner [closed]
How can I make the function more efficient?
This is all the test code I wrote:
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:flutter_test/flutter_test.dart';
...
1
vote
1
answer
67
views
List<dynamic>' is not a subtype of type 'Iterable<String> in flutter while fetching data from local storage
I am creating a demo for adding and removing favourite products ID to an obs list and later to save to local storage...
While starting the app, it should fetch all favourite products IDs from storage.
...
1
vote
0
answers
33
views
Custom scrollPhysics that allows overscroll
Overscroll should be allowed. When scrolling to the upper and lower limit of the scroll there should be one item left on screen. The list should not bounce back. But the should be a smooth scrolling
...
0
votes
1
answer
58
views
Create new List when Button is pressed
How can I generate a new List by clicking on a Button?
Can it be done using a loop or something similar?
List<List<Countries>> groups = [];
...
child: GestureDetector(
onTap: () {...
0
votes
0
answers
35
views
Flutter Widget offset in a ListView does not perform like expected
I made a timetable schedule with items inside.
But when I scroll the ScrollView the item disappears, as soon as the slot leaves the view.
I tried a CustomScrollView with a SliverList making for each ...
1
vote
1
answer
81
views
Return value from all list elements
Because I have no mock-data currently available, I created my own and I'm currently struggling to get specific values out of it.
The idea is to have a list of playlists, which I already instantiated, ...
0
votes
2
answers
46
views
Comparing the same result of List<Map<String, Object>> is not true
I'm trying to compare values from a List which consists of Map<String, Object>, but the result always returns false despite the value I'm comparing it with is the same. Is there something I did ...
0
votes
1
answer
30
views
Add a List of Document References into a flutter/firebase document field
I got this code:
var testList = <String>[];
await db
.collection('tests')
.where('user', arrayContainsAny: [db.doc('users/' + uid)])
.get()
.then((value) {
...
0
votes
0
answers
34
views
Moving element from the list to the top of the screen in Flutter
Im interested in making a list of elements in which if I press any element it will expand and move to the top of the parent widget (in my case I use scaffold). In other words im looking for a way to ...
0
votes
2
answers
62
views
Different behavior when using const before a const constructor in Dart
In the Dart documentation, it states that we should not place const before initializing a const constructor, as the keyword is already implicit.
However, can someone explain why the following codes ...
-1
votes
0
answers
16
views
Exception caught by widgets library ═RangeError (index): Invalid value: Valid value range is empty: 0
i am having this error i tried to use list of cart from api getcartproducts to store in products list then to use in my widgets i don't know what is the issue!
if some one can help me i am not expert ...
0
votes
1
answer
76
views
How to dynamically execute list.map inside a Widget (Dart/Flutter)
I'm trying to dynamically add lines to a widget that would change depending on how many elements an array holds.
However, I run into the following error over the second list operator (everything ...
0
votes
1
answer
121
views
Spread operator to append List to List or Lists in Dart?
I'm trying to figure out how to use the spread operator to append a List<int> to the end of a List<List<int>>.
I know that I can use the .addAll method, however that doesn't seem to ...
0
votes
1
answer
26
views
Build list of widgets from asynchronous call [duplicate]
I need to make a dynamic list of Widgets
Then I created a function that returns a list of widgets
@override
Widget build(BuildContext context) {
return Container(
child: SingleChildScrollView(
...
1
vote
1
answer
38
views
type 'List<dynamic>' is not a subtype of type 'Iterable<String>' while fetching data from localstorage?
I have created LocalStorage class for saving data to local storage
The main purpose of this class to store like favourite products, cart Items and thats why I have use T so that the saveData and ...
0
votes
3
answers
47
views
How do I assign the length of a list to a double in Flutter?
I am trying to assign the length of a list to a double and it says that an instance member can't be accessed in an initializer:
List numlist = [1,2,3,4,5];
double size = numlist.length.toDouble();
Is ...
0
votes
0
answers
36
views
How to disable the flutter default List.generate Dropdown effect
enter image description here List.generate( controller.skills.length,
(index) => buildSkillWidget(index))
I'm trying to disable the default dropdown effect of listView when we set the data. I ...
0
votes
1
answer
56
views
Error Unhandled Exception: Converting object to an encodable object failed: Instance of 'listActivities' when i am trying to add new data to list
so i am trying to add a new object to activity and i store it in local storage, the code looks like this
pushObjectWisata(selectedIndex, selectedObjectId) async {
PengunjungModel ...
0
votes
1
answer
38
views
FLutter when i use a streambuilder to display data from firebase it just says true when on phone
I wish to display a list of events store in firebase firestore and it works well on android emulator and web but when i try it on my real phone it instead just returns the text true to the page. I ...
0
votes
1
answer
29
views
how to access a List<Map> in flutter
I have the following list:
List<Map> list = [{'id': 5, 'title': 'fdf', 'description': 'fdf'}];
Now, I want to access this list and retrieve, for example, the title value to store it in a ...
0
votes
0
answers
25
views
Flutter CustomScrollView not resizing
I am trying to create an infinite list that does not modify scroll position when adding items at the top or at the bottom of the list. My prototype is comprised of a CustomScrollView that hosts two ...
0
votes
0
answers
56
views
Widgets not load data from cache in ios
I am using "home_widget" flutter package to add home widget option to my flutter application.
I saved data from my flutter code to cache by "shared_prefences".
this is my swift ...
0
votes
1
answer
76
views
defining and accessing a list to build the content of a popup menu button including icons
In _HomePageState I have a PopupMenuButton defined as
PopupMenuButton(
icon: Icon(Icons.more_vert),
itemBuilder: (BuildContext context) {
return <...
0
votes
0
answers
42
views
How to show a list of lists that contain lists with unknown field names?
I'm new to using Flutter and have to make a model class for a weirdly structured API that I can't seem to find any solutions for within the documentation or anywhere online.
Here's how the JSON file ...
1
vote
2
answers
414
views
How should I pass a List of String to a riverpod provider without breaking it?
I'm using riverpod with code generation for state management.
Here, I've a variable named 'handle' which is passed onto the constructor of my widget and then I need to pass this variable in a list to ...
0
votes
0
answers
29
views
What can I do when getting "type 'List<String>' is not a subtype of type 'String' in type cast" in flutter when i want to output list of values?
i have the error of "type 'List' is not a subtype of type 'String' in type cast" when ever i pass data of summary question widget to the result screen widget
i was expecting to view the ...
0
votes
0
answers
43
views
Flutter: How to add items and save it in local storage?
I'm new into flutter and I want to code a Flashcard App. But at the moment, I don't know how to continue coding. I'm stuck at adding a new flashcard and saving the learning set with the title and ...
0
votes
1
answer
48
views
Flutter API fetch code throws "index out of range" using Bloc
i use bloc for state management to fetch data from api
FutureOr<void> fetchAllDrinksList(
GetAllDrinksList event, Emitter<HomeState> emit) async {
await apiRepository....
0
votes
0
answers
20
views
A list for displaying speeds
I have a list that should change depending on the passed value, how do I move the pointer to the current value? Also, I need to understand how this list can be moved dynamically?
Now this is a list ...
0
votes
1
answer
535
views
Unsupported operation: Cannot add to a fixed-length list
Hello I have a Flutter app and a UserModel which was generated by Amplify. In the UserModel I have two fields named followers and following which are lists. I wish to add the userID to them when the ...
0
votes
1
answer
55
views
Modify the element of a json that is inside a list
I hope you can please help me, In my project I am creating a simple list "List listArticulosAdd = [ ];" where i put this map of a json that im decoding from a request https:
mapArticuleCode =...
0
votes
2
answers
112
views
Find common elements in two lists when elements contain more than 1 word -Dart
I am trying to build an app that can find specific ingredients in a food item's list of ingredients.
I have a list of food ingredients called filtered results
filtered results: [{key: enriched corn ...
1
vote
2
answers
74
views
Get Multiple Inputs from User - Flutter
I have a form with about 15 textform fields to input data by the user. What is the best solution for this?
I have currently created a list like below:
List<TextEditingController> textController =...
0
votes
1
answer
83
views
Read json file and parse the data key and value using flutter
I'm currently trying to read json from azure blob storage which I'm able to do.
Now I want to parse the data and display or print the data in Flutter (dart language).
Below is the code.
Future<...
1
vote
1
answer
48
views
Remove item from a list and return list as a constant
I have an enum called Activities, which is defined as such
enum Activities {
Football,
Basketball,
Painting
}
Now I want to create an enum called ActivityTypes, which is supposed to be ...
0
votes
0
answers
136
views
how can I drag-and-drop one screen to another screen in flutter
I have a specific question regarding implementing a feature in my Flutter app. I'm currently working on a screen that utilizes a TabBar with two buttons, essentially representing two separate screens. ...
0
votes
1
answer
55
views
How to map a List of Lists from JSON
Let's say I have a TestObject object that I am using for a JSON response from my API.
I also have an A Object and a B object.
Within my TestObject response, I am getting a List of Object A, but I am ...
0
votes
0
answers
45
views
Flutter fill in a List based on data contained in other two lists
I have three list models as follow (oversimplified):
class Product extends Object {
int? type;
Product({type});
Product.fromJson(Map<String, dynamic> json) {
type= json["type"...
0
votes
1
answer
2k
views
Bloc State not reload or updating widget ui when i was emit a list
i try to change listSelctedTest with add/remove function in bloc, but my ui widget not reload/update after emit a listSelectedTest. but, if using ctr+s/hot reload it will change to new value and ...
0
votes
2
answers
73
views
Flutter dynamic list foreach
I Have a list and items [0,1,2,3,4,5]
when i try to print this list
i get output like this: [0, 1, 2, 3, 4, 5]
But I want to get output like this
0
1
2
3
4
5
My Code:
GFButton(
onPressed:...
1
vote
0
answers
105
views
How to reduce duration of apk generation with flutter?
I am experiencing very long apk generation time (14 984 seconds to be accurate) for a 500 lines of code program, so I am wondering if I am doing something wrong.
I am using flutter, the flutter build ...
0
votes
1
answer
36
views
how can I remove Models from a list by the index in flutter
So I have a List with some Models in it
List<add_ingridients_list> added_ingridients_list = [
add_ingridients_list("a", "b", "c"),
add_ingridients_list("a&...
0
votes
1
answer
48
views
list of model inside another model save only last added item in all itens of the list
for (int x=0; x<listaEquipes.length; x++) {
await _loadEquipe(listaEquipes[x].id.toString());
TabelaListaEquipes _reg = TabelaListaEquipes();
_reg.equipeId = listaEquipes[x].id....
-1
votes
2
answers
244
views
How to notify users whenever an item added to a list without refreshing the whole list in flutter
in flutter i have a listView that gets it's item from a list and the list is downloded from the internet, whenever a new item added to the list i have an event that tells the app a new item added, and ...
0
votes
1
answer
97
views
how can i add Models to a list by a fuction in flutter
Let's assume we have a Model class like this:
`class add_ingredients_list {
String? Ingredient_name;
String? Ingredient_mass;
String? Ingredient_mass_unit;
add_ingredients_list(
this....
0
votes
2
answers
58
views
type 'Future<List<SurveyData>>' is not a subtype of type 'List<SurveyData>' in type cast (DART)
I'm trying to retrieve data from a database, and have made these two methods inside of a certain "TodoDB" class:
Future<List<SurveyData>> fetchAll() async {
final database =...
0
votes
1
answer
28
views
I get 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>?' in type cast. Question: How to Create generic response model
In some cases, the response.data can come as an object or a List
example
{
"status_code": 200,
"status": "success",
"data": [
{
&...
1
vote
1
answer
85
views
How to Call Second, third, or whatever Element From a set in a List in Dart or Flutter
As an example, if you have a list containing several sets of data as the following example of list
Set mySet = Set.from([{7,8,9}, {1,2,3}, {15,25,50,75,66}]);
How to call any specific element in such ...
1
vote
2
answers
76
views
Flutter list getting sync between screens
I have a list on Screen A
I Navigate to Screen B passing list on Screen A and modify few fields in the list in Screen B
And I press back.
Then the Screen A list is also getting updated.
I need to ...