NullAwareTypeConverter<D, S extends Object> class
abstract
A type converter automatically mapping null
values to null
in both
directions.
Instead of overriding fromSql and toSql, subclasses of this converter should implement requireFromSql and requireToSql, which are used to map non-null values to and from sql values, respectively.
Apart from the implementation changes, subclasses of this converter can be used just like all other type converters.
- Inheritance
-
- Object
- TypeConverter<
D?, S?> - NullAwareTypeConverter
Constructors
- NullAwareTypeConverter()
-
Constant default constructor, allowing subclasses to be constant.
const
-
NullAwareTypeConverter.wrap(TypeConverter<
D, S> inner) -
Wraps an
inner
type converter that only considers non-nullable values as a type converter that handles null values too.constfactory
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
fromSql(
S? fromDb) → D? -
Maps a column from the database back to Dart.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requireFromSql(
S fromDb) → D - Maps a non-null column from the database back to Dart.
-
requireToSql(
D value) → S - Map a non-null value from an object in Dart into something that will be understood by the database.
-
toSql(
D? value) → S? -
Map a value from an object in Dart into something that will be understood
by the database.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
wrapFromSql<
D, S> (TypeConverter< D, S> inner, S? sqlValue) → D? -
Invokes a non-nullable
inner
type converter for a single conversion from SQL to Dart. -
wrapToSql<
D, S> (TypeConverter< D, S> inner, D? dartValue) → S? -
Invokes a non-nullable
inner
type converter for a single conversion from Dart to SQL.