mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-09 18:50:11 +08:00
9
lib/utils/parse_bool.dart
Normal file
9
lib/utils/parse_bool.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'package:flutter/foundation.dart' show ValueGetter;
|
||||
|
||||
bool? safeToBool(dynamic value, [ValueGetter<String>? orString]) =>
|
||||
switch (value) {
|
||||
bool _ => value,
|
||||
int _ => value == 1,
|
||||
String _ => orString != null && value == orString(),
|
||||
_ => null,
|
||||
};
|
||||
Reference in New Issue
Block a user