String testing = '["Template","Data","Manual","Checklist","Others"]';
How to convert this string (look like list) into the 'List-String'
CodePudding user response:
this is in JSON format, so you need just to decode it :
first, import the dart convert:
import "dart:convert";
then use the jsonDecode to get a list :
List list = jsonDecode(testing);
this will result a List<dynamic>
, then you can cast it's type if you want :
List<String> listOfStrings = (jsonDecode(testing) as List).map((e) => e as String).toList();