enable prefer_null_aware_operators (#77105)

This commit is contained in:
Michael Goderbauer 2021-03-02 16:14:03 -08:00 committed by GitHub
parent 8818840aa6
commit 6586a069bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 7 deletions

View file

@ -175,7 +175,7 @@ linter:
- prefer_is_not_operator
- prefer_iterable_whereType
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
# - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
- prefer_null_aware_operators
# - prefer_relative_imports # not yet tested
- prefer_single_quotes
- prefer_spread_collections

View file

@ -267,7 +267,7 @@ class GestureArenaManager {
bool _debugLogDiagnostic(int pointer, String message, [ _GestureArena? state ]) {
assert(() {
if (debugPrintGestureArenaDiagnostics) {
final int? count = state != null ? state.members.length : null;
final int? count = state?.members.length;
final String s = count != 1 ? 's' : '';
debugPrint('Gesture arena ${pointer.toString().padRight(4)}$message${ count != null ? " with $count member$s." : ""}');
}

View file

@ -65,7 +65,7 @@ Widget buildFormFrame({
iconEnabledColor: iconEnabledColor,
isDense: isDense,
isExpanded: isExpanded,
items: items == null ? null : items.map<DropdownMenuItem<String>>((String item) {
items: items?.map<DropdownMenuItem<String>>((String item) {
return DropdownMenuItem<String>(
key: ValueKey<String>(item),
value: item,

View file

@ -54,9 +54,7 @@ Widget buildDropdown({
Color? focusColor,
Color? dropdownColor,
}) {
final List<DropdownMenuItem<String>>? listItems = items == null
? null
: items.map<DropdownMenuItem<String>>((String item) {
final List<DropdownMenuItem<String>>? listItems = items?.map<DropdownMenuItem<String>>((String item) {
return DropdownMenuItem<String>(
key: ValueKey<String>(item),
value: item,

View file

@ -692,7 +692,7 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
onListen: _start,
onCancel: _stop,
);
_appName = app == null ? null : app.name.replaceAll('.app', '');
_appName = app?.name?.replaceAll('.app', '');
}
final IOSSimulator device;