mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-09 10:40:12 +08:00
10 lines
282 B
Dart
10 lines
282 B
Dart
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,
|
|
};
|