mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-09 10:40:12 +08:00
7 lines
145 B
Dart
7 lines
145 B
Dart
int? safeToInt(dynamic value) => switch (value) {
|
|
int _ => value,
|
|
String _ => int.tryParse(value),
|
|
num _ => value.toInt(),
|
|
_ => null,
|
|
};
|