Skip to content

Commit ad49e25

Browse files
authored
Revert "[null-safety] reland: migrate app side flutter driver to null-safety (flutter#67441)" (flutter#67561)
This reverts commit d411242.
1 parent e98e0b4 commit ad49e25

37 files changed

+123
-174
lines changed

packages/flutter/analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ analyzer:
1010
type_init_formals: false # https://github.com/dart-lang/linter/issues/2192
1111
unrelated_type_equality_checks: false # https://github.com/dart-lang/linter/issues/2196
1212
void_checks: false # https://github.com/dart-lang/linter/issues/2185
13-
unnecessary_null_comparison: false # Turned off until null-safe rollout is complete.
13+
unnecessary_null_comparison: false # https://github.com/dart-lang/language/issues/1018 , turned off until https://github.com/flutter/flutter/issues/61042

packages/flutter_driver/analysis_options.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/flutter_driver/lib/flutter_driver.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// @dart = 2.8
6-
75
/// Provides API to test Flutter applications that run on real
86
/// devices and emulators.
97
///

packages/flutter_driver/lib/src/common/diagnostics_tree.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ class GetDiagnosticsTree extends CommandWithTarget {
2727
GetDiagnosticsTree(SerializableFinder finder, this.diagnosticsType, {
2828
this.subtreeDepth = 0,
2929
this.includeProperties = true,
30-
Duration? timeout,
30+
Duration timeout,
3131
}) : assert(subtreeDepth != null),
3232
assert(includeProperties != null),
3333
super(finder, timeout: timeout);
3434

3535
/// Deserializes this command from the value generated by [serialize].
3636
GetDiagnosticsTree.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
37-
: subtreeDepth = int.parse(json['subtreeDepth']!),
37+
: subtreeDepth = int.parse(json['subtreeDepth']),
3838
includeProperties = json['includeProperties'] == 'true',
39-
diagnosticsType = _diagnosticsTypeIndex.lookupBySimpleName(json['diagnosticsType']!),
39+
diagnosticsType = _diagnosticsTypeIndex.lookupBySimpleName(json['diagnosticsType']),
4040
super.deserialize(json, finderFactory);
4141

4242
/// How many levels of children to include in the JSON result.
@@ -69,7 +69,7 @@ class DiagnosticsTreeResult extends Result {
6969

7070
/// The JSON encoded [DiagnosticsNode] tree requested by the
7171
/// [GetDiagnosticsTree] command.
72-
final Map<String, dynamic> json;
72+
final Map<String, Object> json;
7373

7474
@override
7575
Map<String, dynamic> toJson() => json;

packages/flutter_driver/lib/src/common/enum_util.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class EnumIndex<E> {
3131
final Map<E, String> _valueToName;
3232

3333
/// Given a [simpleName] finds the corresponding enum value.
34-
E lookupBySimpleName(String simpleName) => _nameToValue[simpleName]!;
34+
E lookupBySimpleName(String simpleName) => _nameToValue[simpleName];
3535

3636
/// Returns the simple name for [enumValue].
37-
String toSimpleName(E enumValue) => _valueToName[enumValue]!;
37+
String toSimpleName(E enumValue) => _valueToName[enumValue];
3838
}
3939

4040
String _getSimpleName(dynamic enumValue) {

packages/flutter_driver/lib/src/common/find.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'message.dart';
1313
mixin DeserializeFinderFactory {
1414
/// Deserializes the finder from JSON generated by [SerializableFinder.serialize].
1515
SerializableFinder deserializeFinder(Map<String, String> json) {
16-
final String? finderType = json['finderType'];
16+
final String finderType = json['finderType'];
1717
switch (finderType) {
1818
case 'ByType': return ByType.deserialize(json);
1919
case 'ByValueKey': return ByValueKey.deserialize(json);
@@ -41,7 +41,7 @@ DriverError _createInvalidKeyValueTypeError(String invalidType) {
4141
/// and add more keys to the returned map.
4242
abstract class CommandWithTarget extends Command {
4343
/// Constructs this command given a [finder].
44-
CommandWithTarget(this.finder, {Duration? timeout}) : super(timeout: timeout) {
44+
CommandWithTarget(this.finder, {Duration timeout}) : super(timeout: timeout) {
4545
if (finder == null)
4646
throw DriverError('$runtimeType target cannot be null');
4747
}
@@ -73,7 +73,7 @@ class WaitFor extends CommandWithTarget {
7373
/// appear within the [timeout] amount of time.
7474
///
7575
/// If [timeout] is not specified, the command defaults to no timeout.
76-
WaitFor(SerializableFinder finder, {Duration? timeout})
76+
WaitFor(SerializableFinder finder, {Duration timeout})
7777
: super(finder, timeout: timeout);
7878

7979
/// Deserializes this command from the value generated by [serialize].
@@ -103,7 +103,7 @@ class WaitForAbsent extends CommandWithTarget {
103103
/// disappear within the [timeout] amount of time.
104104
///
105105
/// If [timeout] is not specified, the command defaults to no timeout.
106-
WaitForAbsent(SerializableFinder finder, {Duration? timeout})
106+
WaitForAbsent(SerializableFinder finder, {Duration timeout})
107107
: super(finder, timeout: timeout);
108108

109109
/// Deserializes this command from the value generated by [serialize].
@@ -165,7 +165,7 @@ class ByTooltipMessage extends SerializableFinder {
165165

166166
/// Deserializes the finder from JSON generated by [serialize].
167167
static ByTooltipMessage deserialize(Map<String, String> json) {
168-
return ByTooltipMessage(json['text']!);
168+
return ByTooltipMessage(json['text']);
169169
}
170170
}
171171

@@ -203,7 +203,7 @@ class BySemanticsLabel extends SerializableFinder {
203203
/// Deserializes the finder from JSON generated by [serialize].
204204
static BySemanticsLabel deserialize(Map<String, String> json) {
205205
final bool isRegExp = json['isRegExp'] == 'true';
206-
return BySemanticsLabel(isRegExp ? RegExp(json['label']!) : json['label']!);
206+
return BySemanticsLabel(isRegExp ? RegExp(json['label']) : json['label']);
207207
}
208208
}
209209

@@ -226,7 +226,7 @@ class ByText extends SerializableFinder {
226226

227227
/// Deserializes the finder from JSON generated by [serialize].
228228
static ByText deserialize(Map<String, String> json) {
229-
return ByText(json['text']!);
229+
return ByText(json['text']);
230230
}
231231
}
232232

@@ -262,8 +262,8 @@ class ByValueKey extends SerializableFinder {
262262

263263
/// Deserializes the finder from JSON generated by [serialize].
264264
static ByValueKey deserialize(Map<String, String> json) {
265-
final String keyValueString = json['keyValueString']!;
266-
final String keyValueType = json['keyValueType']!;
265+
final String keyValueString = json['keyValueString'];
266+
final String keyValueType = json['keyValueType'];
267267
switch (keyValueType) {
268268
case 'int':
269269
return ByValueKey(int.parse(keyValueString));
@@ -293,7 +293,7 @@ class ByType extends SerializableFinder {
293293

294294
/// Deserializes the finder from JSON generated by [serialize].
295295
static ByType deserialize(Map<String, String> json) {
296-
return ByType(json['type']!);
296+
return ByType(json['type']);
297297
}
298298
}
299299

@@ -319,8 +319,8 @@ class PageBack extends SerializableFinder {
319319
class Descendant extends SerializableFinder {
320320
/// Creates a descendant finder.
321321
const Descendant({
322-
required this.of,
323-
required this.matching,
322+
@required this.of,
323+
@required this.matching,
324324
this.matchRoot = false,
325325
this.firstMatchOnly = false,
326326
});
@@ -354,9 +354,9 @@ class Descendant extends SerializableFinder {
354354
/// Deserializes the finder from JSON generated by [serialize].
355355
static Descendant deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) {
356356
final Map<String, String> jsonOfMatcher =
357-
Map<String, String>.from(jsonDecode(json['of']!) as Map<String, dynamic>);
357+
Map<String, String>.from(jsonDecode(json['of']) as Map<String, dynamic>);
358358
final Map<String, String> jsonMatchingMatcher =
359-
Map<String, String>.from(jsonDecode(json['matching']!) as Map<String, dynamic>);
359+
Map<String, String>.from(jsonDecode(json['matching']) as Map<String, dynamic>);
360360
return Descendant(
361361
of: finderFactory.deserializeFinder(jsonOfMatcher),
362362
matching: finderFactory.deserializeFinder(jsonMatchingMatcher),
@@ -374,8 +374,8 @@ class Descendant extends SerializableFinder {
374374
class Ancestor extends SerializableFinder {
375375
/// Creates an ancestor finder.
376376
const Ancestor({
377-
required this.of,
378-
required this.matching,
377+
@required this.of,
378+
@required this.matching,
379379
this.matchRoot = false,
380380
this.firstMatchOnly = false,
381381
});
@@ -409,9 +409,9 @@ class Ancestor extends SerializableFinder {
409409
/// Deserializes the finder from JSON generated by [serialize].
410410
static Ancestor deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) {
411411
final Map<String, String> jsonOfMatcher =
412-
Map<String, String>.from(jsonDecode(json['of']!) as Map<String, dynamic>);
412+
Map<String, String>.from(jsonDecode(json['of']) as Map<String, dynamic>);
413413
final Map<String, String> jsonMatchingMatcher =
414-
Map<String, String>.from(jsonDecode(json['matching']!) as Map<String, dynamic>);
414+
Map<String, String>.from(jsonDecode(json['matching']) as Map<String, dynamic>);
415415
return Ancestor(
416416
of: finderFactory.deserializeFinder(jsonOfMatcher),
417417
matching: finderFactory.deserializeFinder(jsonMatchingMatcher),
@@ -436,7 +436,7 @@ class Ancestor extends SerializableFinder {
436436
class GetSemanticsId extends CommandWithTarget {
437437

438438
/// Creates a command which finds a Widget and then looks up the semantic id.
439-
GetSemanticsId(SerializableFinder finder, {Duration? timeout}) : super(finder, timeout: timeout);
439+
GetSemanticsId(SerializableFinder finder, {Duration timeout}) : super(finder, timeout: timeout);
440440

441441
/// Creates a command from a JSON map.
442442
GetSemanticsId.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)

packages/flutter_driver/lib/src/common/frame_sync.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import 'message.dart';
77
/// A Flutter Driver command that enables or disables the FrameSync mechanism.
88
class SetFrameSync extends Command {
99
/// Creates a command to toggle the FrameSync mechanism.
10-
const SetFrameSync(this.enabled, { Duration? timeout }) : super(timeout: timeout);
10+
const SetFrameSync(this.enabled, { Duration timeout }) : super(timeout: timeout);
1111

1212
/// Deserializes this command from the value generated by [serialize].
1313
SetFrameSync.deserialize(Map<String, String> params)
14-
: enabled = params['enabled']!.toLowerCase() == 'true',
14+
: enabled = params['enabled'].toLowerCase() == 'true',
1515
super.deserialize(params);
1616

1717
/// Whether frameSync should be enabled or disabled.

packages/flutter_driver/lib/src/common/fuchsia_compat.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// @dart = 2.8
6-
75
/// Convenience methods for Flutter application driving on Fuchsia. Can
86
/// be run on either a host machine (making a remote connection to a Fuchsia
97
/// device), or on the target Fuchsia machine.
8+
import 'dart:core';
109
import 'dart:io';
1110

1211
import 'package:fuchsia_remote_debug_protocol/fuchsia_remote_debug_protocol.dart';

packages/flutter_driver/lib/src/common/geometry.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ EnumIndex<OffsetType> _offsetTypeIndex = EnumIndex<OffsetType>(OffsetType.values
3333
/// to device pixels via [Window.devicePixelRatio].
3434
class GetOffset extends CommandWithTarget {
3535
/// The `finder` looks for an element to get its rect.
36-
GetOffset(SerializableFinder finder, this.offsetType, { Duration? timeout }) : super(finder, timeout: timeout);
36+
GetOffset(SerializableFinder finder, this.offsetType, { Duration timeout }) : super(finder, timeout: timeout);
3737

3838
/// Deserializes this command from the value generated by [serialize].
3939
GetOffset.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
40-
: offsetType = _offsetTypeIndex.lookupBySimpleName(json['offsetType']!),
40+
: offsetType = _offsetTypeIndex.lookupBySimpleName(json['offsetType']),
4141
super.deserialize(json, finderFactory);
4242

4343
@override

packages/flutter_driver/lib/src/common/gesture.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'message.dart';
88
/// A Flutter Driver command that taps on a target widget located by [finder].
99
class Tap extends CommandWithTarget {
1010
/// Creates a tap command to tap on a widget located by [finder].
11-
Tap(SerializableFinder finder, { Duration? timeout }) : super(finder, timeout: timeout);
11+
Tap(SerializableFinder finder, { Duration timeout }) : super(finder, timeout: timeout);
1212

1313
/// Deserializes this command from the value generated by [serialize].
1414
Tap.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) : super.deserialize(json, finderFactory);
@@ -42,15 +42,15 @@ class Scroll extends CommandWithTarget {
4242
this.dy,
4343
this.duration,
4444
this.frequency, {
45-
Duration? timeout,
45+
Duration timeout,
4646
}) : super(finder, timeout: timeout);
4747

4848
/// Deserializes this command from the value generated by [serialize].
4949
Scroll.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
50-
: dx = double.parse(json['dx']!),
51-
dy = double.parse(json['dy']!),
52-
duration = Duration(microseconds: int.parse(json['duration']!)),
53-
frequency = int.parse(json['frequency']!),
50+
: dx = double.parse(json['dx']),
51+
dy = double.parse(json['dy']),
52+
duration = Duration(microseconds: int.parse(json['duration'])),
53+
frequency = int.parse(json['frequency']),
5454
super.deserialize(json, finderFactory);
5555

5656
/// Delta X offset per move event.
@@ -96,11 +96,11 @@ class ScrollResult extends Result {
9696
class ScrollIntoView extends CommandWithTarget {
9797
/// Creates this command given a [finder] used to locate the widget to be
9898
/// scrolled into view.
99-
ScrollIntoView(SerializableFinder finder, { this.alignment = 0.0, Duration? timeout }) : super(finder, timeout: timeout);
99+
ScrollIntoView(SerializableFinder finder, { this.alignment = 0.0, Duration timeout }) : super(finder, timeout: timeout);
100100

101101
/// Deserializes this command from the value generated by [serialize].
102102
ScrollIntoView.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
103-
: alignment = double.parse(json['alignment']!),
103+
: alignment = double.parse(json['alignment']),
104104
super.deserialize(json, finderFactory);
105105

106106
/// How the widget should be aligned.

0 commit comments

Comments
 (0)