Reputation: 91
I m getting this error while making one popup for language selection Builder is required. also Undefined name 'Utils' in second section of code
void _languageCheck() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final firstRun = prefs.getBool("firstRunLanguage");
(firstRun ?? false)
? () {}
: await showDialog(
barrierDismissible: false,
context: context,
child: AlertDialog(content: LanguageDialog()));
await prefs.setBool('firstRunLanguage', true);
}
Widget build(BuildContext context) {
late List<Widget> list = [];
late List<Map<String, dynamic>> languages = Utils.getLanguagesList(context);
for (var i = 0; i < languages.length; i++) {
// if (langCode == languages[i]["code"]) {
// print(languages[i]["code"]);
// }
Upvotes: 0
Views: 478
Reputation: 1193
First error is because showDialog
has a required builder
param, check out the documentation. https://api.flutter.dev/flutter/material/showDialog.html
Second error must be a missing import. Make sure you import whatever package exports Utils
.
Upvotes: 3