static int? boolToInt(bool? value) { try { return value != null && value == true ? 1 : 0; } on Exception catch (e) { return 0; } }