草庐IT

run_test

全部标签

unit-testing - 有没有办法在 Flutter 单元测试中测试 AppLifecycleState 的变化?

当我的应用移至后台(AppLifecycleState.paused)时,我的应用会将用户首选项写入本地文件,我想为此行为编写一个测试。有没有办法在单元测试中模仿它?或者这是需要作为集成测试完成的事情吗? 最佳答案 您可以在单元测试中调用binding.handleAppLifecycleStateChanged来伪造应用进出前台。 关于unit-testing-有没有办法在Flutter单元测试中测试AppLifecycleState的变化?,我们在StackOverflow上找到一个

unit-testing - 有没有办法在 Flutter 单元测试中测试 AppLifecycleState 的变化?

当我的应用移至后台(AppLifecycleState.paused)时,我的应用会将用户首选项写入本地文件,我想为此行为编写一个测试。有没有办法在单元测试中模仿它?或者这是需要作为集成测试完成的事情吗? 最佳答案 您可以在单元测试中调用binding.handleAppLifecycleStateChanged来伪造应用进出前台。 关于unit-testing-有没有办法在Flutter单元测试中测试AppLifecycleState的变化?,我们在StackOverflow上找到一个

android-studio - 运行命令 "flutter run"时出错

关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭4年前。Improvethisquestion如何解决这个错误->当我运行flutterrun命令时,出现以下错误。Error:Nopubspec.yamlfilefound.ThiscommandshouldberunfromtherootofyourFlutterproject.DonotrunthiscommandfromtherootofyourgitcloneofFlutter.即使flutterdoctor-v也没有显示任何错误。

android-studio - 运行命令 "flutter run"时出错

关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭4年前。Improvethisquestion如何解决这个错误->当我运行flutterrun命令时,出现以下错误。Error:Nopubspec.yamlfilefound.ThiscommandshouldberunfromtherootofyourFlutterproject.DonotrunthiscommandfromtherootofyourgitcloneofFlutter.即使flutterdoctor-v也没有显示任何错误。

flutter - 飞镖 flutter : How to run animation from a scoped-model?

如何在作用域模型的作用域模型后代的小部件中运行动画。我这里有一个红色按钮,单击它会显示一个正方形。正方形在3秒后消失,这恰好很快。我想要做的是让广场在几秒钟内消失。我尝试了AnimationController,但它需要一个“vsync:”参数,我看到它通常在initState()中作为“vsync:this”完成,并且在其他地方使用时会出错。import'package:flutter/material.dart';import'dart:async';import'package:scoped_model/scoped_model.dart';voidmain(){runApp(n

flutter - 飞镖 flutter : How to run animation from a scoped-model?

如何在作用域模型的作用域模型后代的小部件中运行动画。我这里有一个红色按钮,单击它会显示一个正方形。正方形在3秒后消失,这恰好很快。我想要做的是让广场在几秒钟内消失。我尝试了AnimationController,但它需要一个“vsync:”参数,我看到它通常在initState()中作为“vsync:this”完成,并且在其他地方使用时会出错。import'package:flutter/material.dart';import'dart:async';import'package:scoped_model/scoped_model.dart';voidmain(){runApp(n

ios - "Running pod install..."无限

我想在IOS模拟器上运行我的应用程序flutter应用程序,但它无限地显示“正在运行pod安装...”我试图找到解决方案,但找不到。这是我的pod文件,由cocoapod自动生成:#Uncommentthislinetodefineaglobalplatformforyourproject#platform:ios,'9.0'#CocoaPodsanalyticssendsnetworkstatssynchronouslyaffectingflutterbuildlatency.ENV['COCOAPODS_DISABLE_STATS']='true'project'Runner',{

ios - "Running pod install..."无限

我想在IOS模拟器上运行我的应用程序flutter应用程序,但它无限地显示“正在运行pod安装...”我试图找到解决方案,但找不到。这是我的pod文件,由cocoapod自动生成:#Uncommentthislinetodefineaglobalplatformforyourproject#platform:ios,'9.0'#CocoaPodsanalyticssendsnetworkstatssynchronouslyaffectingflutterbuildlatency.ENV['COCOAPODS_DISABLE_STATS']='true'project'Runner',{

unit-testing - 如何对 Flutter TextFormField maxlines 进行单元测试

是否可以编写一个单元测试来验证TextFormField的maxLines属性是否设置正确。我找不到访问该属性的方法:我创建一个TextFormFieldfinalfield=TextFormField(initialValue:"hello",key:Key('textformfield'),maxLines:2,);然后在测试中我可以使用tester.widget访问表单字段finalformfield=awaittester.widget(find.byKey(Key('textformfield')));但是由于maxLines属性被传递给返回文本字段的生成器,我如何才能访问文

unit-testing - 如何对 Flutter TextFormField maxlines 进行单元测试

是否可以编写一个单元测试来验证TextFormField的maxLines属性是否设置正确。我找不到访问该属性的方法:我创建一个TextFormFieldfinalfield=TextFormField(initialValue:"hello",key:Key('textformfield'),maxLines:2,);然后在测试中我可以使用tester.widget访问表单字段finalformfield=awaittester.widget(find.byKey(Key('textformfield')));但是由于maxLines属性被传递给返回文本字段的生成器,我如何才能访问文