mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
opt.: replace first with firstOrNull
This commit is contained in:
@@ -70,7 +70,7 @@ class Backup {
|
||||
|
||||
Backup.loadFromStore()
|
||||
: version = backupFormatVersion,
|
||||
date = DateTime.now().toString().split('.').first,
|
||||
date = DateTime.now().toString().split('.').firstOrNull ?? '',
|
||||
spis = Stores.server.fetch(),
|
||||
snippets = Stores.snippet.fetch(),
|
||||
keys = Stores.key.fetch(),
|
||||
|
||||
@@ -92,7 +92,8 @@ class OneTimeCpuStatus extends TimeSeqIface<OneTimeCpuStatus> {
|
||||
|
||||
for (var item in raw.split('\n')) {
|
||||
if (item == '') break;
|
||||
final id = item.split(' ').first;
|
||||
final id = item.split(' ').firstOrNull;
|
||||
if (id == null) continue;
|
||||
final matches = item.replaceFirst(id, '').trim().split(' ');
|
||||
cpus.add(
|
||||
OneTimeCpuStatus(
|
||||
|
||||
@@ -50,7 +50,7 @@ class Temperatures {
|
||||
return _map[key];
|
||||
}
|
||||
}
|
||||
return _map.values.first;
|
||||
return _map.values.firstOrNull;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user