enable lint prefer_conditional_assignment (#12694)

This commit is contained in:
Alexandre Ardhuin
2017-10-25 08:18:26 +02:00
committed by GitHub
parent d69fcea1a8
commit 872d83a3c5
5 changed files with 6 additions and 10 deletions

View File

@@ -111,7 +111,7 @@ linter:
- prefer_adjacent_string_concatenation
# - prefer_asserts_in_initializer_lists # not yet tested
- prefer_collection_literals
# - prefer_conditional_assignment # not yet tested
- prefer_conditional_assignment
- prefer_const_constructors
# - prefer_const_constructors_in_immutables # not yet tested
# - prefer_constructors_over_static_methods # not yet tested

View File

@@ -105,7 +105,7 @@ linter:
- prefer_adjacent_string_concatenation
# - prefer_asserts_in_initializer_lists # not yet tested
- prefer_collection_literals
# - prefer_conditional_assignment # not yet tested
- prefer_conditional_assignment
- prefer_const_constructors
# - prefer_const_constructors_in_immutables # not yet tested
# - prefer_constructors_over_static_methods # not yet tested

View File

@@ -798,8 +798,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
Route<dynamic> route;
if (initialRouteName != Navigator.defaultRouteName)
route = _routeNamed(initialRouteName, allowNull: true);
if (route == null)
route = _routeNamed(Navigator.defaultRouteName);
route ??= _routeNamed(Navigator.defaultRouteName);
push(route);
}
for (Route<dynamic> route in _history)

View File

@@ -85,8 +85,7 @@ class AnsiTerminal {
///
/// Useful when the console is in [singleCharMode].
Stream<String> get onCharInput {
if (_broadcastStdInString == null)
_broadcastStdInString = io.stdin.transform(ASCII.decoder).asBroadcastStream();
_broadcastStdInString ??= io.stdin.transform(ASCII.decoder).asBroadcastStream();
return _broadcastStdInString;
}

View File

@@ -995,11 +995,9 @@ class Isolate extends ServiceObjectOwner {
}
void _updateHeaps(Map<String, dynamic> map, bool mapIsRef) {
if (_newSpace == null)
_newSpace = new HeapSpace._empty(this);
_newSpace ??= new HeapSpace._empty(this);
_newSpace._update(map['new'], mapIsRef);
if (_oldSpace == null)
_oldSpace = new HeapSpace._empty(this);
_oldSpace ??= new HeapSpace._empty(this);
_oldSpace._update(map['old'], mapIsRef);
}