Message.fromJson constructor

Message.fromJson(
  1. Map<String, dynamic> json, {
  2. String what = 'A message response',
})

Implementation

factory Message.fromJson(
  Map<String, dynamic> json, {
  String what = 'A message response',
}) {
  // Empty is allowed here, unlike the tokens and identifiers elsewhere: this
  // is prose for a human, and an endpoint that has nothing to say is not a
  // fault worth failing the call over.
  return Message(
    message: requireString(json, 'message', what, allowEmpty: true),
  );
}