Answers for "convert map values to string list flutter"

1

flutter how to turn a string in a map

import 'dart:convert';
...
Map valueMap = json.decode(value);
// or
Map valueMap = jsonDecode(value);
Posted by: Guest on September-08-2021
0

convert map values to string list flutter

~~~ Convert Map values to string list flutter

~~~ Example code below

    final Map<dynamic, dynamic> json = {
      "name": "alice",
      "data": ["foo", "bar", "baz"],
    };

    // method 1, cast while mapping:
    final data1 = (json["data"] as List)?.map((e) => e as String)?.toList();
    print("method 1 prints: $data1");
Posted by: Guest on March-08-2022

Code answers related to "convert map values to string list flutter"

Browse Popular Code Answers by Language