var mydata = JSON.decode(snapshot.data.toString());
when I convert JSON file data to string it throws "Undefine name JSON"
It should be json not JSON, Also make sure to import dart-convert-library
import 'dart:convert';
var dataConvertedToJSON = json.decode(snapshot.data.toString());
json, notJSON, more here: api.flutter.dev/flutter/dart-convert/json-constant.html