boolean function

dynamic boolean(
  1. dynamic intOrBool, {
  2. bool isInt = true,
})

Converts a SQLite boolean (stored as 0/1) back to a Dart bool.

  • When isInt is true (the default), intOrBool is read as a number.
  • When isInt is false, intOrBool is returned as a bool.
  • null stays null.

Implementation

dynamic boolean(dynamic intOrBool, {bool isInt = true}) {
  if (intOrBool == null) return null;
  if (isInt) return (intOrBool as num) > 0;
  return intOrBool as bool;
}