use null aware operators (#32711)
* use null aware operators * rollback changes about null-aware operator * disable lint prefer_is_not_empty
This commit is contained in:
committed by
GitHub
parent
3c16cf6a74
commit
4fa32df141
@@ -46,6 +46,5 @@ class Config {
|
||||
|
||||
String _userHomeDir() {
|
||||
final String envKey = platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
|
||||
final String value = platform.environment[envKey];
|
||||
return value == null ? '.' : value;
|
||||
return platform.environment[envKey] ?? '.';
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ class IOSSimulator extends Device {
|
||||
if (isSupported())
|
||||
return 'Supported';
|
||||
|
||||
return _supportMessage != null ? _supportMessage : 'Unknown';
|
||||
return _supportMessage ?? 'Unknown';
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'watcher.dart';
|
||||
|
||||
/// Prints JSON events when running a test in --machine mode.
|
||||
class EventPrinter extends TestWatcher {
|
||||
EventPrinter({StringSink out}) : _out = out == null ? stdout: out;
|
||||
EventPrinter({StringSink out}) : _out = out ?? stdout;
|
||||
|
||||
final StringSink _out;
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ class FlutterVersion {
|
||||
@override
|
||||
String toString() {
|
||||
final String versionText = frameworkVersion == 'unknown' ? '' : ' $frameworkVersion';
|
||||
final String flutterText = 'Flutter$versionText • channel $channel • ${repositoryUrl == null ? 'unknown source' : repositoryUrl}';
|
||||
final String flutterText = 'Flutter$versionText • channel $channel • ${repositoryUrl ?? 'unknown source'}';
|
||||
final String frameworkText = 'Framework • revision $frameworkRevisionShort ($frameworkAge) • $frameworkCommitDate';
|
||||
final String engineText = 'Engine • revision $engineRevisionShort';
|
||||
final String toolsText = 'Tools • Dart $dartSdkVersion';
|
||||
|
||||
@@ -718,13 +718,11 @@ class VM extends ServiceObjectOwner {
|
||||
|
||||
/// The number of bytes allocated (e.g. by malloc) in the native heap.
|
||||
int _heapAllocatedMemoryUsage;
|
||||
int get heapAllocatedMemoryUsage {
|
||||
return _heapAllocatedMemoryUsage == null ? 0 : _heapAllocatedMemoryUsage;
|
||||
}
|
||||
int get heapAllocatedMemoryUsage => _heapAllocatedMemoryUsage ?? 0;
|
||||
|
||||
/// The peak resident set size for the process.
|
||||
int _maxRSS;
|
||||
int get maxRSS => _maxRSS == null ? 0 : _maxRSS;
|
||||
int get maxRSS => _maxRSS ?? 0;
|
||||
|
||||
// The embedder's name, Flutter or dart_runner.
|
||||
String _embedder;
|
||||
|
||||
@@ -121,7 +121,7 @@ void testUsingContext(
|
||||
},
|
||||
);
|
||||
});
|
||||
}, timeout: timeout != null ? timeout : const Timeout(Duration(seconds: 60)),
|
||||
}, timeout: timeout ?? const Timeout(Duration(seconds: 60)),
|
||||
testOn: testOn, skip: skip);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user