我正在使用VScode.I构建一个颤振应用程序,在仿真器上安装apk之后,我得到了一个错误,但是应用程序启动失败,一个错误出现在模拟器屏幕上,如下所示:
NoSuchMethodError: The method 'Of' was called on null.
Receiver:Null.
Tried calling: of(Instance of 'StatelessElement')
See also https://flutter.dev/docs/testing/errors
在控制台上进行检查时,可以看到以下内容:
══╡ EXCEPTION
我正试着让一个领航员来处理我的图标。我把我所有的图标都列在一个列中,它在我所有的屏幕上都存在,当我点击菜单左边的一个图标时,我希望能够转到不同的屏幕。右下角的图标已经被禁用,我只是用这些图标来引用第一页和第二页。
我已经在MyApp小部件中设置了一个导航器,它有到两个名为第一页和第二页的测试页面的路由,尽管当我单击图标并尝试路由到另一个页面时,我会得到以下错误:
The following assertion was thrown while handling a gesture:
Navigator operation requested with a context that d
我正在使用这个包插件flutter_locales进行应用程序本地化。因此,使用以下代码来检查当前的语言代码。 LocaleNotifier.of(context)!.locale!.languageCode; 现在的问题是,如果我在简单的类中使用这段代码,它会给出一个关于"context“的错误。 class Service {
var lang = LocaleNotifier.of(context)!.locale!.languageCode; // getting error on "context"
} 那么如何在服务类中没有BuildContext的情
我想在单击底部选项卡时显示一个SnackBar小部件。我尝试将其显示为:
Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text("Live Clicked"),
));
然而,应用程序抛出了以下异常:
I/flutter ( 4965): The following assertion was thrown while handling a gesture:
I/flutter ( 4965): Scaffold.of() called wi
我试图做的是打开我的应用程序下载屏幕时,没有互联网连接,就像youtube,但我正面临这个错误。
lib/main.dart:5:8: Error: Not found: 'dart:js'
import 'dart:js';
^
lib/main.dart:34:31: Error: The argument type 'Context' can't be assigned to the parameter type 'BuildContext'.
- 'Context' is fro
我想在initState方法中从数据库中获取一个值。因此,我尝试通过使用Provider.of(context)方法调用函数来访问值。但是,我得到了以下错误:
E/flutter ( 6424): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Error: Could not find the correct Provider<RestaurantTimings> above this MyApp Widget
E/flutter ( 6424):
E/flutter ( 6424): This
我正在学习颤栗,并试图用继承的小部件和地图列表制作一个便笺应用程序和3个笔记。问题是,到目前为止,当我试图运行该应用程序时,会引发这个错误:I/flutter (32083): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter (32083): The following NoSuchMethodError was thrown building HomeScreen(dirty, state: I/flutter (320