Json class
Constructors
-
Json(Object? jsonObject, [void _onError(String message)?])
-
Create Json from the Object
const
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
-
asBool([bool? defaultValue])
→ bool
-
If object is bool then return it otherwise throw FormatException
-
asBoolOr([bool? defaultValue])
→ bool?
-
If object is bool then return it otherwise default value
-
asDouble([double? defaultValue])
→ double
-
If object is double then return it otherwise throw FormatException
-
asDoubleOr([double? defaultValue])
→ double?
-
If object is double then return it otherwise default value
-
asInt([int? defaultValue])
→ int
-
If object is int then return it otherwise throw FormatException
-
asIntOr([int? defaultValue])
→ int?
-
If object is int then return it otherwise default value
-
asList([List? defaultValue])
→ JsonList
-
Convert Json to the JsonList or create JsonList from
defaultValue
-
asListOr([List? defaultValue])
→ JsonList?
-
Convert Json to the JsonList or create JsonList from
defaultValue
-
asMap([Map<String, dynamic>? defaultValue])
→ JsonMap
-
Convert Json to the JsonMap or create JsonMap from
defaultValue
-
asMapOr([Map<String, dynamic>? defaultValue])
→ JsonMap?
-
Convert Json to the JsonMap or create JsonMap from
defaultValue
-
asNum([num? defaultValue])
→ num
-
If object is num then return it otherwise throw FormatException
-
asNumOr([num? defaultValue])
→ num?
-
If object is num then return it otherwise default value
-
asObject()
→ Object?
-
Return Json source object
-
asString([String? defaultValue])
→ String
-
If object is
string
then return it otherwise throw FormatException
-
asStringOr([String? defaultValue])
→ String?
-
If object is String then return it otherwise default value
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
inherited
Static Properties
-
onError
↔ void Function(String message)
-
getter/setter pair