Unverified Commit 71c1f6c3 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

enable lint unnecessary_nullable_for_final_variable_declarations (#66387)

parent 97d67993
...@@ -192,6 +192,7 @@ linter: ...@@ -192,6 +192,7 @@ linter:
- unnecessary_new - unnecessary_new
- unnecessary_null_aware_assignments - unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators - unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides - unnecessary_overrides
- unnecessary_parenthesis - unnecessary_parenthesis
- unnecessary_statements - unnecessary_statements
......
...@@ -453,13 +453,13 @@ class StandardMessageCodec implements MessageCodec<dynamic> { ...@@ -453,13 +453,13 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
return buffer.getFloat64List(length); return buffer.getFloat64List(length);
case _valueList: case _valueList:
final int length = readSize(buffer); final int length = readSize(buffer);
final dynamic result = List<dynamic>.filled(length, null, growable: false); final List<dynamic> result = List<dynamic>.filled(length, null, growable: false);
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
result[i] = readValue(buffer); result[i] = readValue(buffer);
return result; return result;
case _valueMap: case _valueMap:
final int length = readSize(buffer); final int length = readSize(buffer);
final dynamic result = <dynamic, dynamic>{}; final Map<dynamic, dynamic> result = <dynamic, dynamic>{};
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
result[readValue(buffer)] = readValue(buffer); result[readValue(buffer)] = readValue(buffer);
return result; return result;
......
...@@ -321,7 +321,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key { ...@@ -321,7 +321,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
final Element? element = _currentElement; final Element? element = _currentElement;
if (element is StatefulElement) { if (element is StatefulElement) {
final StatefulElement statefulElement = element; final StatefulElement statefulElement = element;
final State? state = statefulElement.state; final State state = statefulElement.state;
if (state is T) if (state is T)
return state; return state;
} }
......
...@@ -181,7 +181,11 @@ class ListWheelChildBuilderDelegate extends ListWheelChildDelegate { ...@@ -181,7 +181,11 @@ class ListWheelChildBuilderDelegate extends ListWheelChildDelegate {
@override @override
Widget? build(BuildContext context, int index) { Widget? build(BuildContext context, int index) {
if (childCount == null) { if (childCount == null) {
final Widget? child = builder(context, index); final Widget child = builder(context, index);
// `child` has a non-nullable return type, but might be null when
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
// ignore: dead_code
return child == null ? null : IndexedSemantics(child: child, index: index); return child == null ? null : IndexedSemantics(child: child, index: index);
} }
if (index < 0 || index >= childCount!) if (index < 0 || index >= childCount!)
......
...@@ -1048,10 +1048,8 @@ mixin WidgetInspectorService { ...@@ -1048,10 +1048,8 @@ mixin WidgetInspectorService {
renderObject.markNeedsPaint(); renderObject.markNeedsPaint();
renderObject.visitChildren(markTreeNeedsPaint); renderObject.visitChildren(markTreeNeedsPaint);
} }
final RenderObject? root = RendererBinding.instance!.renderView; final RenderObject root = RendererBinding.instance!.renderView;
if (root != null) {
markTreeNeedsPaint(root); markTreeNeedsPaint(root);
}
} else { } else {
debugOnProfilePaint = null; debugOnProfilePaint = 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