fromJson method

  1. @override
Either<L, R> fromJson(
  1. Map<String, dynamic> json
)

Implementation

@override
Either<L, R> fromJson(Map<String, dynamic> json) {
  assert(json.length == 1);

  switch (json.keys.first) {
    case 'l':
      return left<L, R>(json.values.first);
    case 'r':
      return right<L, R>(json.values.first);
    default:
      throw TypeError();
  }
}