简体   繁体   English

如何在测试(Flutter)中访问这些字段?

[英]How can I access these field in testing ( Flutter)?

I have these fields below in-state class and I want to test if these fields work correctly.我在州内类下面有这些字段,我想测试这些字段是否正常工作。 So I write testing dart file, how can I access these field in a testing file所以我编写了测试 dart 文件,如何在测试文件中访问这些字段

class _LoginPageState extends State<LoginPage> {
      String _phoneNumber = "";
  String _smsCode = "";
  String _verificationId = "";
  int _currentStep = 0;

  List<StepState> _stepsState = [
    StepState.editing,
    StepState.indexed,
    StepState.indexed
  ];

  bool _showProgress = false;
  String _displayName = '';
  File _imageFile;

  bool _labeling = false;

  List<ImageLabel> _labels = List();

}

You can use @visibleForTesting annotation from any of these packages您可以使用任何这些包中的@visibleForTesting注释

import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Flutter 测试中做到这一点 - How can I do this in Flutter Testing Flutter 集成测试:我可以在任何页面上开始测试吗? 如何? - Flutter integration testing: can I start the test on any page? How? 如何从测试中访问 Firebase Flutter 插件? - How can I access the Firebase Flutter plugin from a test? 如何从 MultiProvider 在 flutter 测试中提供的上下文中读取值? - How can I read a value from context that is provided by MultiProvider in flutter testing? 如何从junit中的Java扩展文件读取和测试类? 如何访问该类进行测试? - How to read and test a class from java extension file in junit? How can I access that class for testing? 仅在测试时,如何允许一个包访问另一个包的未导出数据? - How can I allow one package access to another package's unexported data only when testing? 在测试Jinja2驱动的Django视图时,如何访问response.context - How can I access response.context when testing a Jinja2 powered Django view 如何在不访问服务器的情况下在XPage页面中进行单元测试? - How can I do unit testing in an XPage page, without access to the server? 我可以在测试R包时访问外部文件吗? - Can I access an external file when testing an R package? 使用UIautomator进行测试时,可以访问多个应用程序的UI组件吗? - Can I access UI components of multiple applications while testing with UIautomator?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM