Segment.fromJson constructor

Segment.fromJson(
  1. Object? j
)

Implementation

factory Segment.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Segment(
    partIndex: switch (json['partIndex']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    startIndex: switch (json['startIndex']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    endIndex: switch (json['endIndex']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    text: switch (json['text']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}