BoolConverterNullable class

Implements serialization and deserialization for bool from bool and int and converts it to an int.

This is a workaround for moodle being special needs and expecting 1 and 0 as input but returning true and false as output.

Usage:

@JsonSerializable()
class MyClass {
  @JsonKey
  @BoolConverter()
  final bool enabled;

  const MyClass(this.enabled);
}
Inheritance

Constructors

BoolConverterNullable()
Implements serialization and deserialization for bool from bool and int and converts it to an int.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

fromJson(dynamic json) → bool?
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(bool? object) → num?
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited