我们已经在TDD方法中启动了一个关于颤振的新项目。我正在使用国家管理的提供者。在编写Widget测试时,我们面临着测试提供者的问题。请您用一个例子建议编写提供者和小部件注入提供程序的单元测试。
我得到了以下问题
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════
The following ProviderNotFoundException was thrown running a test:
Error: Could not find the correct Provider
使用Provider和FutureBuilder,我刚刚从数据库中删除了数据,同时删除了它,它显示了一个带有坏状态的红色屏幕,没有任何元素。添加数据没有问题,请不要显示此问题。代码如下所示
栈迹
ter (12519): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (12519): The following StateError was thrown building ViewNoteScreen(dirty, de
我是Flutter新手,这是我第一次在YouTube教程之后使用ChangeNotifierProxyProvider。我做了正确的方式,但我得到了这个错误的vs代码。我错过了什么或者我做错了什么吗?请帮我解决这个问题。谢谢。
误差Null check operator used on a null value
main.dart
MultiProvider(
providers: [
ChangeNotifierProvider(
create: (_) => AuthProvider(),
),
//s
我正在尝试使用path_provider包获取应用程序文档目录。我正在使用蜂巢数据库,所以我需要路径。
这是我的密码:
void main() async {
final appDocsDir = await getApplicationDocumentsDirectory(); //error is on this line
Hive.init(appDocsDir.path);
runApp(MyApp());
}
我得到了这个错误:
E/flutter (18811): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandle
当我尝试在path_provider中使用蜂窝时,我的Flutter项目中出现了这个错误。有没有办法解决这个问题,因为我尝试了在测试版和主频道之间切换,并将flutter sdk min设置为2.11。 调用path_provider.getApplicationDocumentsDirectory();时显示此错误 Unhandled Exception: Null check operator used on a null value
#0 MethodChannel.binaryMessenger (package:flutter/src/services/platform_
flutter抛出了这些错误,但他找不到的图像并不存在!确实存在的图像位于assets/ images /文件夹中,并且具有其他(普通)名称。我在pubspec.yaml中正确地导入了它们,对于这个奇怪的问题有什么解决方案? ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset: as
以下是来自Android的错误消息:
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building MyZippyApp(dirty):
'package:provider/src/provider.dart': Failed assertion: line 181 pos 16: 'create != null': is not tru
我想使用包来管理我的路由,但是在安装和配置它之后,我无法运行我的应用程序并在控制台上接收以下错误。
: Error: Property 'window' cannot be accessed on 'WidgetsBinding?' because it is potentially null.
../…/provider/auto_route_information_provider.dart:20
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart&
我不能将图像作为背景文件上传到容器中,我已经将图像添加到as文件夹中,并将其添加到pubspec.yaml中,并向我显示了该错误:
I/flutter ( 6664): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter ( 6664): The following assertion was thrown resolving an image codec:
I/flutter ( 6664): Unable to load
我无法从资产文件夹中获取图像。异常显示图像提供者:AssetImage(包: null,名称:"assets/1.jpg")请帮助我
/flutter ( 7667): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter ( 7667): The following assertion was thrown resolving an image codec:
I/flutter ( 7667): Unable
当我试图在android上运行终端中的“颤振运行”应用程序时,我会得到以下错误.
/C:/Users/Acer/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'.
return super.inheritFromElement(ancestor, aspect: aspect);
我刚刚开始学习颤振,当我试图添加一个以网络映像为源的图像时,我遇到了这个错误。我试着寻找解决方案,但还是找不到。这样谁就能让我知道问题出在哪里了?谢谢。
这是源代码
Error: The argument type 'Image' can't be assigned to the parameter type 'ImageProvider<Object>'.
('/C:/src/Flutter/flutter/packages/flutter/lib/src/widgets/image.dart').'ImagePr
我想在我的项目中为提供者(ChangeNotifierProvider)创建一个单元测试,我的单元测试、小部件测试和集成测试成功地通过了✔️,所以现在我尝试了(努力尝试)若要为提供程序创建单元测试,请执行以下操作。我能够检查上下文,但是当检查提供者的初始值(必须为0)时,我得到了这个异常❌:
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following ProviderNotFoundError was thrown runni
我正在尝试创建一个在颤栗中的待办事项列表应用程序。我正面临一个小部件的问题,它帮助我编辑已经创建的关于标题或描述的待办小部件。
这是我的待办事项清单HomePage的照片
这张我的编辑按钮的照片
在我按下这个小部件中的保存按钮后,我面临一个问题
,这是我得到的错误
════════ Exception caught by gesture ═══════════════════════════════════════════
The following _CastError was thrown while handling a gesture:
Null chec
对于CI,我需要编写一个运行flutter test integration_test并捕获stdout结果的程序。在python中,代码是:
import subprocess
process = subprocess.Popen(
f'flutter test integration_test',
shell=True,
universal_newlines=True,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE)
print('starting')
for l
我有一个工作正常的滚动视图,但是当操作完成并返回到家乡时,它会抛出一个错误,并且滚动视图不再是可执行的。
控制台错误:
======== Exception caught by gesture ===============================================================
The following assertion was thrown while handling a gesture: ScrollController attached to multiple scroll views. 'package:flutter/src/w
我想在背景中设置图像,我已经在项目名称下创建了一个资产文件夹,并将图像粘贴在其中,我编写了下面的代码。但它显示出这样的错误,
I/flutter (13556):
I/flutter (13556): When the exception was thrown, this was the stack:
I/flutter (13556): #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
I/flutter (13556): <asynchronous susp
我开始学习颤振,我正在尝试使用提供者。我遵循了几个教程,现在开始了我的附带项目,但是我被这些错误困住了:
Error: Could not find the correct Provider<CultivatorModel> above this CultivatorComponent Widget
当我用Multiproviders包装MaterialApp时,它应该在祖先中.这个错误对我来说没有意义,我肯定是新来的,我错过了一些显而易见的东西.
总之,这是我的密码,谢谢你的帮助。
main.dart
import 'package:provider/provider.d
图像不显示在颤振应用程序。但我在调试控制台中发现了一些错误。
I/FlutterActivityDelegate(22603): onResume setting current activity to this
I/FlutterActivityDelegate(22603): onResume setting current activity to this
I/Timeline(22603): Timeline: Activity_idle id: android.os.BinderProxy@3eb59326 time:39937973
I/flutter (22603): ══╡ E
我正在开发一个简单的ListView应用程序,它可以从互联网上填充,并使用提供者存储在数据库中。但是ListView没有被填充。它在条目获取器上变得无效。但在我改变了对消费者的看法之后。
现在我得到一个错误,在null上调用了getter项。
堆栈过流
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (15505): The following NoSuchMethodError was thrown building