JsonClass class Null safety

Abstract class that other classes should extend to provide conversion to or from JSON.

Constructors

JsonClass()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toJson() Map<String, dynamic>
Abstract function that concrete classes must implement. This must encode the internal data model to a JSON compatible representation. [...]
toString() String
Returns the string encoded JSON representation for this class. This will remove all null values and empty collections from the returned string.
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

fromDynamicList<T>(Iterable? list, JsonClassBuilder<T> builder) List<T>?
Helper function to create a list of dynamic objects given a builder that can build a single object.
parseBool(dynamic value) bool
Parses the dynamic value into a bool. This will return true if and only if the value is... [...]
parseDouble(dynamic value, [double? defaultValue]) double?
Parses the dynamic value into a double. The value may be a String, int, or double. If the value cannot be successfully parsed into a double then the defaultValue will be returned. [...]
parseDurationFromMillis(dynamic value, [Duration? defaultValue]) Duration?
Parses a duration from milliseconds. The value may be an int, double, or number encoded String. If the value cannot be processed into a duration then this will return the defaultValue.
parseDurationFromSeconds(dynamic value, [Duration? defaultValue]) Duration?
Parses a duration from seconds. The value may be an int, double, or number encoded String. If the value cannot be processed into a duration then this will return the defaultValue.
parseInt(dynamic value, [int? defaultValue]) int?
Parses the dynamic value into a int. The value may be a String, int, double. If the value cannot be successfully parsed into an int then [the defaultValue will be returned.
parseUtcMillis(dynamic value, [int? defaultValue]) DateTime?
Parses the given UTC Millis into a proper DateTime class. If the value cannot be processed then this will return the defaultValue.
removeNull(dynamic input, [bool removeEmptyCollections = true]) → dynamic
Removes null values from the given input. This defaults to removing empty lists and maps. To override this default, set the optional removeEmptyCollections to false. [...]
toJsonList(List<JsonClass>? list) List?
Converts the given list of JsonClass objects into JSON. If the given list is null then null will be returned.