How do I Import a local Json file in order to use the data
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You'll probably want to do something like this in your code:File file = new File(_kConfigFile);final Map<String, List<Map<String, String>>> data =file.existsSync()? convert.JSON.decode(file.readAsStringSync(),): <String, List<Map<String, String>>>{};And then use the resulting json object to create widgets.
On Fri, Sep 8, 2017 at 10:12 AM, Michael Tawiah Sowah <michael...@gmail.com> wrote:
How do I Import a local Json file in order to use the data
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
var a = await rootBundle.loadString('assets/countries.json');
var b = JSON.decode(a);
print(JSON.decode(a));
b.forEach((Map map) => names.add(new NameData.fromJson(map)));
return "xyzzy";
}
--
Ian Hickson
😸