class Field is an abstract mutable field delegate that can be used as an interface to access different data sources.

See example usage in shared_preferences_field_delegate


The class Field contains value getter, setter and a stream of changes

Field<int> intField;
int value = intField.get();
Future<void> result = intField.set(1);
Stream<int> changes = intField.onChanged;

You can map a value of Field to another type with method

Field<int> intField;
Field<String> mappedField =<int, String>(
  source: intField,
  mapToSource: (value) => int.parse(value),
  mapFromSource: (value) => value.toString(),

If you have a nullable Field, you can map it to a non-nullable Field with a default value. Use Field.notNullable function for it

Field<int?> intNullableField;
Field<int> intNotNullableField = Field.notNullable(
  source: nullableFiled,
  defaultValue: 0,