MaybeInaccessibleMessage.fromJson constructor

MaybeInaccessibleMessage.fromJson(
  1. Map<String, dynamic> json
)

Constructor from JSON data

Implementation

factory MaybeInaccessibleMessage.fromJson(Map<String, dynamic> json) {
  final hasOnlyThreeProps = json.keys.length == 3;
  if (hasOnlyThreeProps) {
    return InaccessibleMessage.fromJson(json);
  } else {
    return Message.fromJson(json);
  }
}