Migrate protocol_discovery to null safety (#91267)
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_tools/src/application_package.dart';
|
||||
@@ -64,7 +62,7 @@ class FakeDevice extends Device {
|
||||
bool ephemeral = true,
|
||||
bool isSupported = true,
|
||||
PlatformType type = PlatformType.web,
|
||||
LaunchResult launchResult,
|
||||
LaunchResult? launchResult,
|
||||
}) : _isSupported = isSupported,
|
||||
_launchResult = launchResult ?? LaunchResult.succeeded(),
|
||||
super(
|
||||
@@ -82,24 +80,24 @@ class FakeDevice extends Device {
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(covariant ApplicationPackage package, {
|
||||
String mainPath,
|
||||
String route,
|
||||
DebuggingOptions debuggingOptions,
|
||||
Map<String, dynamic> platformArgs,
|
||||
String? mainPath,
|
||||
String? route,
|
||||
DebuggingOptions? debuggingOptions,
|
||||
Map<String, dynamic>? platformArgs,
|
||||
bool prebuiltApplication = false,
|
||||
bool ipv6 = false,
|
||||
String userIdentifier,
|
||||
String? userIdentifier,
|
||||
}) async => _launchResult;
|
||||
|
||||
@override
|
||||
Future<bool> stopApp(covariant ApplicationPackage app, {
|
||||
String userIdentifier,
|
||||
String? userIdentifier,
|
||||
}) async => true;
|
||||
|
||||
@override
|
||||
Future<bool> uninstallApp(
|
||||
covariant ApplicationPackage app, {
|
||||
String userIdentifier,
|
||||
String? userIdentifier,
|
||||
}) async => true;
|
||||
|
||||
@override
|
||||
@@ -140,12 +138,12 @@ class FakePollingDeviceDiscovery extends PollingDeviceDiscovery {
|
||||
final StreamController<Device> _onRemovedController = StreamController<Device>.broadcast();
|
||||
|
||||
@override
|
||||
Future<List<Device>> pollingGetDevices({ Duration timeout }) async {
|
||||
Future<List<Device>> pollingGetDevices({ Duration? timeout }) async {
|
||||
lastPollingTimeout = timeout;
|
||||
return _devices;
|
||||
}
|
||||
|
||||
Duration lastPollingTimeout;
|
||||
Duration? lastPollingTimeout;
|
||||
|
||||
@override
|
||||
bool get supportsPlatform => true;
|
||||
@@ -185,19 +183,15 @@ class FakeDeviceLogReader extends DeviceLogReader {
|
||||
@override
|
||||
String get name => 'FakeLogReader';
|
||||
|
||||
StreamController<String> _cachedLinesController;
|
||||
|
||||
bool disposed = false;
|
||||
|
||||
final List<String> _lineQueue = <String>[];
|
||||
StreamController<String> get _linesController {
|
||||
_cachedLinesController ??= StreamController<String>
|
||||
late final StreamController<String> _linesController =
|
||||
StreamController<String>
|
||||
.broadcast(onListen: () {
|
||||
_lineQueue.forEach(_linesController.add);
|
||||
_lineQueue.clear();
|
||||
});
|
||||
return _cachedLinesController;
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<String> get logLines => _linesController.stream;
|
||||
|
||||
Reference in New Issue
Block a user