[Solved] How to load json in main method Flutter?

Found the Solution using FutureBuilder class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { _load() async { final file = await rootBundle.loadString(‘assets/j.json’); final data = await jsonDecode(file); print(data.toString()); } @override Widget build(BuildContext context) { return FutureBuilder( future: _load(), builder: (_, AsyncSnapshot<dynamic> snapshot) { return !snapshot.hasData ? Container( color: … Read more

[Solved] How to fix this error calling getter in view from controller in flutter using GetX [closed]

Changing _answersModel to answersModel would fix your issue. Also calling AnswersController.answersModel doesn’t work because answersModel is not a static field, I think you meant call answersController.answersModel Note: Adding an underscore to a class file is making it private field in dart/flutter which means it can’t be accessed in another file. solved How to fix this … Read more