-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.refactorImproving readability/efficiency without behavioral changesImproving readability/efficiency without behavioral changesteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Most of the Flutter codebase takes full advantage of null-aware operators, but I found a few spots here and there that could be improved.
// before
if (query != null) {
return query._data;
}
return null;
// after
return query?.data;// before
if (box != null) {
return box.size.width;
}
return _kWidth;
// after
return box?.size.width ?? _kWidth;// before
if (visual != null) {
return visual;
}
if (logical != null) {
return logical;
}
return 'BorderRadius.zero';
// after
return visual ?? logical ?? 'BorderRadius.zero';Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.refactorImproving readability/efficiency without behavioral changesImproving readability/efficiency without behavioral changesteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team