4

我正在尝试在 app_test.dart 文件中获取设备 ID。但我收到以下错误。在执行以下命令时:flutter drive --target=test_driver/app.dart。

请在下面找到错误详细信息:

I/flutter (20622): Observatory listening on http://127.0.0.1:43149/9iUskIArAjk=/
../../../FlutterSDK/flutter/packages/flutter/lib/src/semantics/semantics.dart:2121:39: Warning: Operand of null-aware operation '!' has type 'List<SemanticsNode>' which excludes null.
 - 'List' is from 'dart:core'.
 - 'SemanticsNode' is from 'package:flutter/src/semantics/semantics.dart' ('../../../FlutterSDK/flutter/packages/flutter/lib/src/semantics/semantics.dart').
    for (int position = 0; position < childrenInDefaultOrder!.length; position += 1) {
                                      ^
lib/utility/colors.dart:1:8: Error: Not found: 'dart:ui'
import 'dart:ui';
       ^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/app.dart:33:1: Error: Not found: 'dart:ui'
export 'dart:ui' show Locale;
^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/basic.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Image, ImageFilter, TextHeightBehavior;
       ^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/binding.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' show AppLifecycleState, Locale, AccessibilityFeatures, FrameTiming, TimingsCallback;
       ^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/binding.dart:24:1: Error: Not found: 'dart:ui'
export 'dart:ui' show AppLifecycleState, Locale;
^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/bottom_navigation_bar_item.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color;
       ^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/color_filter.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui';
       ^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/editable_text.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui hide TextStyle;
       ^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/focus_manager.dart:8:8: Error: Not found: 'dart:ui'
import 'dart:ui';
       ^
../../../FlutterSDK/flutter/packages/flutter/lib/src/widgets/focus_traversal.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui';
       ^
Stopping application instance.
Driver tests failed: 254
4

1 回答 1

-1

此问题与从目标脚本中引用颤振代码有关。你根本不能这样做:https ://github.com/flutter/flutter/issues/27826

您可以使用requestDatafrom Flutter driver 在您的目标和驱动程序代码之间进行通信,并在您的目标脚本中获取所需的值。更多信息:https ://www.kabisa.nl/tech/extending-flutter-driver-with-custom-commands/

于 2020-12-04T20:51:16.757 回答