BoolConverter constructor

const BoolConverter()

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);
}

Implementation

const BoolConverter();