boolean function
Converts a SQLite boolean (stored as 0/1) back to a Dart bool.
- When
isIntistrue(the default),intOrBoolis read as a number. - When
isIntisfalse,intOrBoolis returned as abool. nullstaysnull.
Implementation
dynamic boolean(dynamic intOrBool, {bool isInt = true}) {
if (intOrBool == null) return null;
if (isInt) return (intOrBool as num) > 0;
return intOrBool as bool;
}