Option<T>.fromJson constructor

Option<T>.fromJson(
  1. dynamic json,
  2. T fromJsonT(
    1. dynamic json
    )
)

Adds support for the json_serializable package.

Implementation

factory Option.fromJson(
  dynamic json,
  T Function(dynamic json) fromJsonT,
) =>
    json != null ? some(fromJsonT(json)) : kNone;