tryFromJson static method

DataSlice? tryFromJson(
  1. Map<String, dynamic>? json
)
override

Creates an instance of this class from the constructor parameters defined in the json object.

Returns null if json is omitted.

Example

class Item extends Serializable {
  const(this.name, this.count);
  final String name;
  final int? count;
}

final Item x = Item.tryFromJson({
  'name': 'apple',
  'count': 10,
});

Implementation

static DataSlice? tryFromJson(final Map<String, dynamic>? json) =>
    json == null ? null : DataSlice.fromJson(json);