mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add null return statements to nullable functions with implicit returns (#94760)
This commit is contained in:
parent
f248064afa
commit
da6e5297ca
@ -304,7 +304,7 @@ class RestorationManager extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
Future<Object?> _methodHandler(MethodCall call) async {
|
||||
Future<void> _methodHandler(MethodCall call) async {
|
||||
switch (call.method) {
|
||||
case 'push':
|
||||
_parseAndHandleRestorationUpdateFromEngine(call.arguments as Map<Object?, Object?>);
|
||||
|
||||
@ -1489,7 +1489,7 @@ class PrioritizedAction extends Action<PrioritizedIntents> {
|
||||
}
|
||||
|
||||
@override
|
||||
Object? invoke(PrioritizedIntents intent) {
|
||||
void invoke(PrioritizedIntents intent) {
|
||||
assert(_selectedAction != null);
|
||||
assert(_selectedIntent != null);
|
||||
_selectedAction.invoke(_selectedIntent);
|
||||
|
||||
@ -3741,13 +3741,13 @@ class _UpdateTextSelectionToAdjacentLineAction<T extends DirectionalCaretMovemen
|
||||
}
|
||||
|
||||
@override
|
||||
Object? invoke(T intent, [BuildContext? context]) {
|
||||
void invoke(T intent, [BuildContext? context]) {
|
||||
assert(state._value.selection.isValid);
|
||||
|
||||
final bool collapseSelection = intent.collapseSelection || !state.widget.selectionEnabled;
|
||||
final TextEditingValue value = state._textEditingValueforTextLayoutMetrics;
|
||||
if (!value.selection.isValid) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_verticalMovementRun?.isValid == false) {
|
||||
@ -3807,7 +3807,7 @@ class _CopySelectionAction extends ContextAction<CopySelectionTextIntent> {
|
||||
final EditableTextState state;
|
||||
|
||||
@override
|
||||
Object? invoke(CopySelectionTextIntent intent, [BuildContext? context]) {
|
||||
void invoke(CopySelectionTextIntent intent, [BuildContext? context]) {
|
||||
if (intent.collapseSelection) {
|
||||
state.cutSelection(intent.cause);
|
||||
} else {
|
||||
|
||||
@ -1077,6 +1077,7 @@ void main() {
|
||||
}
|
||||
return inactivePressedOverlayColor;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const double splashRadius = 24.0;
|
||||
TestGesture gesture;
|
||||
|
||||
@ -305,6 +305,7 @@ class TestClipPaintingContext extends PaintingContext {
|
||||
ClipRectLayer? oldLayer,
|
||||
}) {
|
||||
this.clipBehavior = clipBehavior;
|
||||
return null;
|
||||
}
|
||||
|
||||
Clip clipBehavior = Clip.none;
|
||||
|
||||
@ -1701,9 +1701,8 @@ class TestContextAction extends ContextAction<TestIntent> {
|
||||
List<BuildContext?> capturedContexts = <BuildContext?>[];
|
||||
|
||||
@override
|
||||
Object? invoke(covariant TestIntent intent, [BuildContext? context]) {
|
||||
void invoke(covariant TestIntent intent, [BuildContext? context]) {
|
||||
capturedContexts.add(context);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1724,7 +1723,7 @@ class LogInvocationAction extends Action<LogIntent> {
|
||||
bool get isActionEnabled => enabled;
|
||||
|
||||
@override
|
||||
Object? invoke(LogIntent intent) {
|
||||
void invoke(LogIntent intent) {
|
||||
final Action<LogIntent>? callingAction = this.callingAction;
|
||||
if (callingAction == null) {
|
||||
intent.log.add('$actionName.invoke');
|
||||
@ -1755,7 +1754,7 @@ class LogInvocationContextAction extends ContextAction<LogIntent> {
|
||||
bool get isActionEnabled => enabled;
|
||||
|
||||
@override
|
||||
Object? invoke(LogIntent intent, [BuildContext? context]) {
|
||||
void invoke(LogIntent intent, [BuildContext? context]) {
|
||||
invokeContext = context;
|
||||
final Action<LogIntent>? callingAction = this.callingAction;
|
||||
if (callingAction == null) {
|
||||
@ -1792,5 +1791,5 @@ class RedirectOutputAction extends LogInvocationAction {
|
||||
final List<String> newLog;
|
||||
|
||||
@override
|
||||
Object? invoke(LogIntent intent) => super.invoke(LogIntent(log: newLog));
|
||||
void invoke(LogIntent intent) => super.invoke(LogIntent(log: newLog));
|
||||
}
|
||||
|
||||
@ -29,5 +29,6 @@ class MockClipboard {
|
||||
_clipboardData = methodCall.arguments;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,6 +792,7 @@ testWidgets('ChildBackButtonDispatcher take priority recursively', (WidgetTester
|
||||
SystemChannels.navigation,
|
||||
(MethodCall methodCall) async {
|
||||
log.add(methodCall);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
final RouteInformationProvider provider = PlatformRouteInformationProvider(
|
||||
|
||||
@ -103,6 +103,7 @@ Widget activatorTester(
|
||||
if (hasSecond)
|
||||
TestIntent2: TestAction(onInvoke: (Intent intent) {
|
||||
onInvoke2(intent);
|
||||
return null;
|
||||
}),
|
||||
},
|
||||
child: Shortcuts(
|
||||
|
||||
@ -212,7 +212,7 @@ class _Diagonal extends RenderObjectWidget with SlottedMultiChildRenderObjectWid
|
||||
Iterable<_DiagonalSlot> get slots => _DiagonalSlot.values;
|
||||
|
||||
@override
|
||||
Widget? childForSlot(Object slot) {
|
||||
Widget? childForSlot(_DiagonalSlot slot) {
|
||||
switch (slot) {
|
||||
case _DiagonalSlot.topLeft:
|
||||
return topLeft;
|
||||
|
||||
@ -38,6 +38,7 @@ void main() {
|
||||
|
||||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform, (MethodCall methodCall) async {
|
||||
log.add(methodCall);
|
||||
return null;
|
||||
});
|
||||
|
||||
await tester.pumpWidget(Title(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user