Unverified Commit d0c0439b authored by Phil Quitslund's avatar Phil Quitslund Committed by GitHub

fixes to anticipate next Dart linter release (#127211)

The upcoming linter release notices null literals as unnecessary argument values and flags more `type_literal_in_constant_pattern` cases. 

See breakages: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8780744067138629361/+/u/analyze_flutter_flutter/stdout
parent e8b7889d
...@@ -123,7 +123,7 @@ abstract final class _UntilNextFrame { ...@@ -123,7 +123,7 @@ abstract final class _UntilNextFrame {
if (_UntilNextFrame._completer == null) { if (_UntilNextFrame._completer == null) {
_UntilNextFrame._completer = Completer<void>(); _UntilNextFrame._completer = Completer<void>();
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
_UntilNextFrame._completer!.complete(null); _UntilNextFrame._completer!.complete();
_UntilNextFrame._completer = null; _UntilNextFrame._completer = null;
}); });
} }
......
...@@ -95,7 +95,7 @@ abstract final class _UntilNextFrame { ...@@ -95,7 +95,7 @@ abstract final class _UntilNextFrame {
if (_UntilNextFrame._completer == null) { if (_UntilNextFrame._completer == null) {
_UntilNextFrame._completer = Completer<void>(); _UntilNextFrame._completer = Completer<void>();
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
_UntilNextFrame._completer!.complete(null); _UntilNextFrame._completer!.complete();
_UntilNextFrame._completer = null; _UntilNextFrame._completer = null;
}); });
} }
......
...@@ -147,7 +147,7 @@ class _UntilNextFrame { ...@@ -147,7 +147,7 @@ class _UntilNextFrame {
if (_UntilNextFrame._completer == null) { if (_UntilNextFrame._completer == null) {
_UntilNextFrame._completer = Completer<void>(); _UntilNextFrame._completer = Completer<void>();
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
_UntilNextFrame._completer!.complete(null); _UntilNextFrame._completer!.complete();
_UntilNextFrame._completer = null; _UntilNextFrame._completer = null;
}); });
} }
......
...@@ -448,7 +448,7 @@ abstract class ImageProvider<T extends Object> { ...@@ -448,7 +448,7 @@ abstract class ImageProvider<T extends Object> {
exception: exception, exception: exception,
stack: stack, stack: stack,
)); ));
completer.complete(null); completer.complete();
} }
}, },
); );
......
...@@ -2569,7 +2569,7 @@ void main() { ...@@ -2569,7 +2569,7 @@ void main() {
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.pop(context, null); Navigator.pop(context);
}, },
child: const Text('Pop route'), child: const Text('Pop route'),
), ),
......
...@@ -319,7 +319,7 @@ void main() { ...@@ -319,7 +319,7 @@ void main() {
expect(binding.restorationManager.rootBucketAccessed, 1); expect(binding.restorationManager.rootBucketAccessed, 1);
expect(find.text('Hello'), findsNothing); expect(find.text('Hello'), findsNothing);
completer.complete(null); completer.complete();
await tester.pump(const Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
expect(binding.restorationManager.rootBucketAccessed, 1); expect(binding.restorationManager.rootBucketAccessed, 1);
......
...@@ -1624,10 +1624,10 @@ class _MatchAnythingExceptClip extends _FailWithDescriptionMatcher { ...@@ -1624,10 +1624,10 @@ class _MatchAnythingExceptClip extends _FailWithDescriptionMatcher {
final RenderObject renderObject = nodes.single.renderObject!; final RenderObject renderObject = nodes.single.renderObject!;
switch (renderObject.runtimeType) { switch (renderObject.runtimeType) {
case RenderClipPath: case const (RenderClipPath):
case RenderClipOval: case const (RenderClipOval):
case RenderClipRect: case const (RenderClipRect):
case RenderClipRRect: case const (RenderClipRRect):
return failWithDescription(matchState, 'had a root render object of type: ${renderObject.runtimeType}'); return failWithDescription(matchState, 'had a root render object of type: ${renderObject.runtimeType}');
default: default:
return true; return true;
......
...@@ -100,11 +100,11 @@ class TestPointer { ...@@ -100,11 +100,11 @@ class TestPointer {
_buttons = buttons; _buttons = buttons;
} }
switch (event.runtimeType) { switch (event.runtimeType) {
case PointerDownEvent: case const (PointerDownEvent):
assert(!isDown); assert(!isDown);
_isDown = true; _isDown = true;
case PointerUpEvent: case const (PointerUpEvent):
case PointerCancelEvent: case const (PointerCancelEvent):
assert(isDown); assert(isDown);
_isDown = false; _isDown = false;
default: default:
......
...@@ -114,7 +114,7 @@ class StdoutHandler { ...@@ -114,7 +114,7 @@ class StdoutHandler {
} }
} }
if (message.length <= messageBoundaryKey.length) { if (message.length <= messageBoundaryKey.length) {
compilerOutput?.complete(null); compilerOutput?.complete();
return; return;
} }
final int spaceDelimiter = message.lastIndexOf(' '); final int spaceDelimiter = message.lastIndexOf(' ');
...@@ -809,7 +809,7 @@ class DefaultResidentCompiler implements ResidentCompiler { ...@@ -809,7 +809,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
// when outputFilename future is not completed, but stdout is closed // when outputFilename future is not completed, but stdout is closed
// process has died unexpectedly. // process has died unexpectedly.
if (_stdoutHandler.compilerOutput?.isCompleted == false) { if (_stdoutHandler.compilerOutput?.isCompleted == false) {
_stdoutHandler.compilerOutput?.complete(null); _stdoutHandler.compilerOutput?.complete();
throwToolExit('the Dart compiler exited unexpectedly.'); throwToolExit('the Dart compiler exited unexpectedly.');
} }
}); });
......
...@@ -184,7 +184,7 @@ class CustomDevicePortForwarder extends DevicePortForwarder { ...@@ -184,7 +184,7 @@ class CustomDevicePortForwarder extends DevicePortForwarder {
// a port forwarding failure and we complete with a null value. // a port forwarding failure and we complete with a null value.
unawaited(process.exitCode.whenComplete(() { unawaited(process.exitCode.whenComplete(() {
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
})); }));
......
...@@ -368,7 +368,7 @@ void main() { ...@@ -368,7 +368,7 @@ void main() {
await FakeAsync().run((FakeAsync time) { await FakeAsync().run((FakeAsync time) {
unawaited(FakeAsyncCrashingDoctor(time, logger).diagnose(verbose: false).then((bool r) { unawaited(FakeAsyncCrashingDoctor(time, logger).diagnose(verbose: false).then((bool r) {
expect(r, isFalse); expect(r, isFalse);
completer.complete(null); completer.complete();
})); }));
time.elapse(const Duration(seconds: 1)); time.elapse(const Duration(seconds: 1));
time.flushMicrotasks(); time.flushMicrotasks();
......
...@@ -176,12 +176,12 @@ void main() { ...@@ -176,12 +176,12 @@ void main() {
caughtByHandler = true; caughtByHandler = true;
} }
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
}, (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
})); }));
time.elapse(const Duration(seconds: 1)); time.elapse(const Duration(seconds: 1));
...@@ -214,12 +214,12 @@ void main() { ...@@ -214,12 +214,12 @@ void main() {
caughtByHandler = true; caughtByHandler = true;
} }
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
}, (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
})); }));
time.elapse(const Duration(seconds: 1)); time.elapse(const Duration(seconds: 1));
...@@ -252,12 +252,12 @@ void main() { ...@@ -252,12 +252,12 @@ void main() {
caughtByHandler = true; caughtByHandler = true;
} }
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
}, (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
})); }));
time.elapse(const Duration(seconds: 1)); time.elapse(const Duration(seconds: 1));
...@@ -292,12 +292,12 @@ void main() { ...@@ -292,12 +292,12 @@ void main() {
caughtByHandler = true; caughtByHandler = true;
} }
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
}, (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete();
} }
})); }));
time.elapse(const Duration(seconds: 1)); time.elapse(const Duration(seconds: 1));
......
...@@ -126,7 +126,7 @@ void main() { ...@@ -126,7 +126,7 @@ void main() {
packageConfig: PackageConfig.empty, packageConfig: PackageConfig.empty,
packagesPath: '.packages', packagesPath: '.packages',
); );
stdoutHandler.compilerOutput?.complete(null); stdoutHandler.compilerOutput?.complete();
completer.complete(); completer.complete();
expect(await output, null); expect(await output, null);
......
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