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