Flutter - Create value and name array

You need a Map for that

var send = {'latitude': widget.lat};

If you really need an array, you can use for example an array of maps

var send = [{'latitude': widget.lat}, {'latitude': 123.456}];

Dart uses Maps for this

to declare a map and you dont know what you will your map contain you can use

Map<String, dynamic> myObject = {'latitude': widget.lat} ;

In your Case you will need a list of objects so you can do it like that :

List<Map<String, dynamic>> send=[] ;

send.add(myObject) ;

Or :

List<Map<String, dynamic>> send=[] ;

send = [{'latitude': widget.lat}]; \\ if you want to assign it directly

Tags:

Dart

Flutter