BaseConverter<FROM, TO> class
abstract
Base class for defining a new type converter.
This class is only for define built-in type support.
Users also can define their desired converter by TypeConverter
annotation.
You have to convert types that don't support in sqlite internally
like bool, double, DateTime and etc.
TO
must be a type that is supported by sqlite like int, String and etc.
After implement class, you have to add your converter in
_builtInSupportSqliteType
and _builtInSupportConverters
variables
in PredefinedConvertersHelper class.
Example:
class BoolConverter implements BaseConverter<bool, int> {
@override
int from(bool value) {
return value ? 1 : 0;
}
@override
bool to(int value) {
return value == 1;
}
}
Pre defined converters: BoolConverter, NullableBoolConverter, DoubleConverter, NullableDoubleConverter, DateTimeConverter, NullableDateTimeConverter. You can define bool, double and DateTime fields in your entities directly.
Constructors
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
-
from(
FROM value) → TO -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
to(
TO value) → FROM -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited