New member
- Joined
- Feb 3, 2023
- Messages
- 3
- Thread Author
- #1
hope you guys have a great day!
I'am learning Flutter, and now i got some obstacle to display data from array object, so i have the array object look like this:
and then, i want to display it on my DropDownItems, somethins looks like this:
====== EDIT =========
and this is my console said (with all red)
i've tried others method, but i still didn't know how to do it right, i got "redline" all over the place
I'am learning Flutter, and now i got some obstacle to display data from array object, so i have the array object look like this:
Code:
// i saved this array object to listLorem var
listLorem = [
{
"ids": 12,
"someText": "Lorem Ipsum #12",
},
{
"ids": 11,
"someText": "Lorem Ipsum #11",
},
]
and then, i want to display it on my DropDownItems, somethins looks like this:
Code:
items: [
DropdownMenuItem(
child: Text("Choose One"),
value: "",
),
listLorem.map((items) => DropdownMenuItem(
child: Text(items.someText),
value: items.ids,
)),
],
====== EDIT =========
and this is my console said (with all red)
Code:
listLorem((items) => DropdownMenuItem(
^
: Error: The argument type 'List<Object>' can't be assigned to the parameter type 'List<DropdownMenuItem<String>>?'.
register.dart:569
- 'List' is from 'dart:core'.
- 'Object' is from 'dart:core'.
- 'DropdownMenuItem' is from 'package:flutter/src/material/dropdown.dart' ('../../../../../flutter/packages/flutter/lib/src/material/dropdown.dart').