Unverified Commit 344ebe02 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

avoid returning null for Future (#23784)

parent 202b045b
...@@ -169,7 +169,7 @@ Future<String> getDartVersion() async { ...@@ -169,7 +169,7 @@ Future<String> getDartVersion() async {
Future<String> getCurrentFlutterRepoCommit() { Future<String> getCurrentFlutterRepoCommit() {
if (!dir('${flutterDirectory.path}/.git').existsSync()) { if (!dir('${flutterDirectory.path}/.git').existsSync()) {
return null; return Future<String>.value(null);
} }
return inDirectory<String>(flutterDirectory, () { return inDirectory<String>(flutterDirectory, () {
......
...@@ -41,12 +41,12 @@ test 1 1 ...@@ -41,12 +41,12 @@ test 1 1
class TestAssetBundle extends AssetBundle { class TestAssetBundle extends AssetBundle {
@override @override
Future<ByteData> load(String key) => null; Future<ByteData> load(String key) async => null;
@override @override
Future<String> loadString(String key, { bool cache = true }) { Future<String> loadString(String key, { bool cache = true }) async {
if (key == 'lib/gallery/example_code.dart') if (key == 'lib/gallery/example_code.dart')
return Future<String>.value(testCodeFile); return testCodeFile;
return null; return null;
} }
......
...@@ -217,7 +217,7 @@ class AssetImage extends AssetBundleImageProvider { ...@@ -217,7 +217,7 @@ class AssetImage extends AssetBundleImageProvider {
static Future<Map<String, List<String>>> _manifestParser(String jsonData) { static Future<Map<String, List<String>>> _manifestParser(String jsonData) {
if (jsonData == null) if (jsonData == null)
return null; return SynchronousFuture<Map<String, List<String>>>(null);
// TODO(ianh): JSON decoding really shouldn't be on the main thread. // TODO(ianh): JSON decoding really shouldn't be on the main thread.
final Map<String, dynamic> parsedJson = json.decode(jsonData); final Map<String, dynamic> parsedJson = json.decode(jsonData);
final Iterable<String> keys = parsedJson.keys; final Iterable<String> keys = parsedJson.keys;
......
...@@ -250,7 +250,7 @@ mixin SchedulerBinding on BindingBase, ServicesBinding { ...@@ -250,7 +250,7 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
} }
} }
Future<String> _handleLifecycleMessage(String message) { Future<String> _handleLifecycleMessage(String message) async {
handleAppLifecycleStateChanged(_parseAppLifecycleMessage(message)); handleAppLifecycleStateChanged(_parseAppLifecycleMessage(message));
return null; return null;
} }
......
...@@ -86,7 +86,7 @@ class TestAssetBundle extends CachingAssetBundle { ...@@ -86,7 +86,7 @@ class TestAssetBundle extends CachingAssetBundle {
Future<String> loadString(String key, { bool cache = true }) { Future<String> loadString(String key, { bool cache = true }) {
if (key == 'AssetManifest.json') if (key == 'AssetManifest.json')
return SynchronousFuture<String>(manifest); return SynchronousFuture<String>(manifest);
return null; return SynchronousFuture<String>(null);
} }
@override @override
......
...@@ -1600,7 +1600,7 @@ class _MockHttpRequest extends HttpClientRequest { ...@@ -1600,7 +1600,7 @@ class _MockHttpRequest extends HttpClientRequest {
List<Cookie> get cookies => null; List<Cookie> get cookies => null;
@override @override
Future<HttpClientResponse> get done => null; Future<HttpClientResponse> get done async => null;
@override @override
Future<void> flush() { Future<void> flush() {
......
...@@ -59,7 +59,7 @@ class ConfigCommand extends FlutterCommand { ...@@ -59,7 +59,7 @@ class ConfigCommand extends FlutterCommand {
/// Return null to disable analytics recording of the `config` command. /// Return null to disable analytics recording of the `config` command.
@override @override
Future<String> get usagePath => null; Future<String> get usagePath async => null;
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
......
...@@ -39,7 +39,7 @@ class ShellCompletionCommand extends FlutterCommand { ...@@ -39,7 +39,7 @@ class ShellCompletionCommand extends FlutterCommand {
/// Return null to disable analytics recording of the `bash-completion` command. /// Return null to disable analytics recording of the `bash-completion` command.
@override @override
Future<String> get usagePath => null; Future<String> get usagePath async => null;
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
......
...@@ -245,5 +245,5 @@ class _NoopPortForwarder extends DevicePortForwarder { ...@@ -245,5 +245,5 @@ class _NoopPortForwarder extends DevicePortForwarder {
List<ForwardedPort> get forwardedPorts => <ForwardedPort>[]; List<ForwardedPort> get forwardedPorts => <ForwardedPort>[];
@override @override
Future<void> unforward(ForwardedPort forwardedPort) => null; Future<void> unforward(ForwardedPort forwardedPort) async { }
} }
...@@ -951,7 +951,7 @@ class VM extends ServiceObjectOwner { ...@@ -951,7 +951,7 @@ class VM extends ServiceObjectOwner {
Future<void> refreshViews() { Future<void> refreshViews() {
if (!isFlutterEngine) if (!isFlutterEngine)
return null; return Future<void>.value();
_viewCache.clear(); _viewCache.clear();
// Send one per-application request that refreshes all views in the app. // Send one per-application request that refreshes all views in the app.
return vmService.vm.invokeRpc<ServiceObject>('_flutter.listViews', timeout: kLongRequestTimeout); return vmService.vm.invokeRpc<ServiceObject>('_flutter.listViews', timeout: kLongRequestTimeout);
......
...@@ -213,7 +213,7 @@ class MockStreamSubscription<T> implements StreamSubscription<T> { ...@@ -213,7 +213,7 @@ class MockStreamSubscription<T> implements StreamSubscription<T> {
Future<E> asFuture<E>([E futureValue]) => Future<E>.value(); Future<E> asFuture<E>([E futureValue]) => Future<E>.value();
@override @override
Future<void> cancel() => null; Future<void> cancel() async { }
@override @override
dynamic noSuchMethod(Invocation invocation) => null; dynamic noSuchMethod(Invocation invocation) => null;
......
...@@ -18,10 +18,10 @@ class TestRunner extends ResidentRunner { ...@@ -18,10 +18,10 @@ class TestRunner extends ResidentRunner {
String receivedCommand; String receivedCommand;
@override @override
Future<void> cleanupAfterSignal() => null; Future<void> cleanupAfterSignal() async { }
@override @override
Future<void> cleanupAtFinish() => null; Future<void> cleanupAtFinish() async { }
@override @override
Future<void> handleTerminalCommand(String code) async { Future<void> handleTerminalCommand(String code) async {
...@@ -39,7 +39,7 @@ class TestRunner extends ResidentRunner { ...@@ -39,7 +39,7 @@ class TestRunner extends ResidentRunner {
Completer<void> appStartedCompleter, Completer<void> appStartedCompleter,
String route, String route,
bool shouldBuild = true, bool shouldBuild = true,
}) => null; }) async => null;
} }
void main() { void main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment