diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index 54954af6bc..d75606ad9a 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -2053,7 +2053,7 @@ class PercentProperty extends DoubleProperty { /// The [showName] and [level] arguments must not be null. PercentProperty( String name, - double fraction, { + double? fraction, { String? ifNull, bool showName = true, String? tooltip, diff --git a/packages/flutter/lib/src/painting/image_cache.dart b/packages/flutter/lib/src/painting/image_cache.dart index 3162553a8a..e8d7066c71 100644 --- a/packages/flutter/lib/src/painting/image_cache.dart +++ b/packages/flutter/lib/src/painting/image_cache.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - import 'dart:developer'; import 'dart:ui' show hashValues; diff --git a/packages/flutter/lib/src/services/binary_messenger.dart b/packages/flutter/lib/src/services/binary_messenger.dart index 6f4e613521..6d2b1c0890 100644 --- a/packages/flutter/lib/src/services/binary_messenger.dart +++ b/packages/flutter/lib/src/services/binary_messenger.dart @@ -49,7 +49,7 @@ abstract class BinaryMessenger { /// /// This method is useful for tests or test harnesses that want to assert the /// handler for the specified channel has not been altered by a previous test. - bool checkMessageHandler(String channel, MessageHandler handler); + bool checkMessageHandler(String channel, MessageHandler? handler); /// Set a mock callback for intercepting messages from the [send] method on /// this class, on the given channel, without decoding them. @@ -70,7 +70,7 @@ abstract class BinaryMessenger { /// This method is useful for tests or test harnesses that want to assert the /// mock handler for the specified channel has not been altered by a previous /// test. - bool checkMockMessageHandler(String channel, MessageHandler handler); + bool checkMockMessageHandler(String channel, MessageHandler? handler); } /// The default instance of [BinaryMessenger]. diff --git a/packages/flutter/lib/src/services/binding.dart b/packages/flutter/lib/src/services/binding.dart index 6f7e769a4e..d53ff9070b 100644 --- a/packages/flutter/lib/src/services/binding.dart +++ b/packages/flutter/lib/src/services/binding.dart @@ -216,8 +216,8 @@ mixin ServicesBinding on BindingBase, SchedulerBinding { /// To use a different [RestorationManager] subclasses can override /// [createRestorationManager], which is called to create the instance /// returned by this getter. - RestorationManager get restorationManager => _restorationManager; - late RestorationManager _restorationManager; + RestorationManager get restorationManager => _restorationManager!; + RestorationManager? _restorationManager; /// Creates the [RestorationManager] instance available via /// [restorationManager]. @@ -319,7 +319,7 @@ class _DefaultBinaryMessenger extends BinaryMessenger { } @override - bool checkMessageHandler(String channel, MessageHandler handler) => _handlers[channel] == handler; + bool checkMessageHandler(String channel, MessageHandler? handler) => _handlers[channel] == handler; @override void setMockMessageHandler(String channel, MessageHandler? handler) { @@ -330,5 +330,5 @@ class _DefaultBinaryMessenger extends BinaryMessenger { } @override - bool checkMockMessageHandler(String channel, MessageHandler handler) => _mockHandlers[channel] == handler; + bool checkMockMessageHandler(String channel, MessageHandler? handler) => _mockHandlers[channel] == handler; } diff --git a/packages/flutter/lib/src/services/platform_channel.dart b/packages/flutter/lib/src/services/platform_channel.dart index 7d6b0d9eec..316af4eaba 100644 --- a/packages/flutter/lib/src/services/platform_channel.dart +++ b/packages/flutter/lib/src/services/platform_channel.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - import 'dart:async'; import 'dart:typed_data'; diff --git a/packages/flutter/test/foundation/change_notifier_test.dart b/packages/flutter/test/foundation/change_notifier_test.dart index 61c6cd0799..29e5ec1347 100644 --- a/packages/flutter/test/foundation/change_notifier_test.dart +++ b/packages/flutter/test/foundation/change_notifier_test.dart @@ -210,8 +210,8 @@ void main() { test('Cannot use a disposed ChangeNotifier', () { final TestNotifier source = TestNotifier(); source.dispose(); - expect(() { source.addListener(null); }, throwsFlutterError); - expect(() { source.removeListener(null); }, throwsFlutterError); + expect(() { source.addListener(() { }); }, throwsFlutterError); + expect(() { source.removeListener(() { }); }, throwsFlutterError); expect(() { source.dispose(); }, throwsFlutterError); expect(() { source.notify(); }, throwsFlutterError); }); diff --git a/packages/flutter/test/painting/image_provider_test.dart b/packages/flutter/test/painting/image_provider_test.dart index ff64d63dd6..ec81db82ff 100644 --- a/packages/flutter/test/painting/image_provider_test.dart +++ b/packages/flutter/test/painting/image_provider_test.dart @@ -136,7 +136,9 @@ void main() { final File file = fs.file('/empty.png')..createSync(recursive: true); final FileImage provider = FileImage(file); - expect(provider.load(provider, null), isA()); + expect(provider.load(provider, (Uint8List bytes, {int cacheWidth, int cacheHeight, bool allowUpscaling}) async { + return Future.value(FakeCodec()); + }), isA()); expect(await error.future, isStateError); }); diff --git a/packages/flutter/test/scheduler/ticker_test.dart b/packages/flutter/test/scheduler/ticker_test.dart index e6ac6de3df..942360778d 100644 --- a/packages/flutter/test/scheduler/ticker_test.dart +++ b/packages/flutter/test/scheduler/ticker_test.dart @@ -96,7 +96,7 @@ void main() { Ticker ticker; void testFunction() { - ticker = Ticker(null); + ticker = Ticker((Duration _) { }); } testFunction(); diff --git a/packages/flutter/test/widgets/binding_test.dart b/packages/flutter/test/widgets/binding_test.dart index a17cfab994..2e84957661 100644 --- a/packages/flutter/test/widgets/binding_test.dart +++ b/packages/flutter/test/widgets/binding_test.dart @@ -194,7 +194,7 @@ void main() { testWidgets('scheduleFrameCallback error control test', (WidgetTester tester) async { FlutterError error; try { - tester.binding.scheduleFrameCallback(null, rescheduling: true); + tester.binding.scheduleFrameCallback((Duration _) { }, rescheduling: true); } on FlutterError catch (e) { error = e; } diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart index 765a486f73..67595a45dd 100644 --- a/packages/flutter/test/widgets/image_test.dart +++ b/packages/flutter/test/widgets/image_test.dart @@ -797,12 +797,12 @@ void main() { expect(listeners.length, 2); // Make sure the first listener can be called re-entrantly - listeners[1].onImage(null, null); - listeners[1].onImage(null, null); + listeners[1].onImage(null, false); + listeners[1].onImage(null, false); // Make sure the second listener can be called re-entrantly. - listeners[0].onImage(null, null); - listeners[0].onImage(null, null); + listeners[0].onImage(null, false); + listeners[0].onImage(null, false); }); testWidgets('Precache completes with onError on error', (WidgetTester tester) async { diff --git a/packages/flutter_test/lib/src/window.dart b/packages/flutter_test/lib/src/window.dart index 2924bf6526..91a0c5248c 100644 --- a/packages/flutter_test/lib/src/window.dart +++ b/packages/flutter_test/lib/src/window.dart @@ -190,7 +190,7 @@ class TestWindow implements Window { @override String get initialLifecycleState => _initialLifecycleStateTestValue; - String _initialLifecycleStateTestValue; + String _initialLifecycleStateTestValue = ''; /// Sets a faked initialLifecycleState for testing. set initialLifecycleStateTestValue(String state) { _initialLifecycleStateTestValue = state;