JsonMapper class
Singleton class providing mostly static methods for conversion of previously annotated by JsonSerializable Dart objects from / to JSON string
Constructors
- JsonMapper()
-
factory
Properties
-
converters
↔ Map<
Type, ICustomConverter> -
getter/setter pair
-
enumValues
↔ Map<
Type, dynamic> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
typeInfoDecorators
↔ Map<
int, ITypeInfoDecorator> -
getter/setter pair
-
valueDecorators
↔ Map<
Type, ValueDecoratorFunction> -
getter/setter pair
Methods
-
clearCache(
) → void - Wipes the internal caches
-
info(
) → void - Prints out current mapper configuration to the console List of currently registered adapters and their priorities
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeAdapter(
IJsonMapperAdapter adapter) → JsonMapper - De-registers previously registered adapter using useAdapter method
-
toString(
) → String -
A string representation of this object.
inherited
-
useAdapter(
IJsonMapperAdapter adapter, [int? priority]) → JsonMapper - Registers an instance of IJsonMapperAdapter with the mapper engine Adapters are meant to be used as a pluggable extensions, widening the number of supported types to be seamlessly converted to/from JSON
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- globalDeserializationOptions ↔ DeserializationOptions
-
global DeserializationOptions
getter/setter pair
- globalSerializationOptions ↔ SerializationOptions
-
global SerializationOptions
getter/setter pair
- instance → JsonMapper
-
final
Static Methods
-
clone<
T> (T object) → T? - Clone Dart object of type T
-
copy<
T> (T object) → T? - Alias for clone method to copy Dart object of type T
-
copyWith<
T> (T object, Map< String, dynamic> map) → T? - Copy Dart object of type T & merge it with Map<String, dynamic>
-
deserialize<
T> (dynamic jsonValue, [DeserializationOptions? options]) → T? -
Converts JSON String Or Object Or Map<String, dynamic> to Dart object instance of type T
jsonValue
could be as of String type, then it will be parsed internallyjsonValue
could be as of Object type, then it will be processed as isjsonValue
could be as of Map<String, dynamic> type, then it will be processed as is -
enumerateAdapters(
Iterable< JsonMapperAdapter> adapters, Function visitor) → void - Enumerates adapter IJsonMapperAdapter instances using visitor pattern Abstracts adapters ordering logic from consumers
-
fromJson<
T> (String jsonValue, [DeserializationOptions? options]) → T? - Converts JSON String to Dart object of type T
-
fromMap<
T> (Map< String, dynamic> ? map, [DeserializationOptions? options]) → T? - Converts Map<String, dynamic> to Dart object instance of type T
-
mergeMaps(
Map< String, dynamic> ? mapA, Map<String, dynamic> mapB) → Map<String, dynamic> - Recursive deep merge two maps
-
serialize(
Object? object, [SerializationOptions? options]) → String - Converts an instance of Dart object to JSON String
-
toJson(
Object? object, [SerializationOptions? options]) → String - Converts Dart object to JSON String
-
toMap(
Object? object, [SerializationOptions? options]) → Map< String, dynamic> ? - Converts Dart object to Map<String, dynamic>
-
toUri(
{Object? getParams, String? baseUrl = ''}) → Uri -
Converts
getParams
object to Uri GET request withbaseUrl