fromMap static method

FormattedText? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static FormattedText? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var text = _map['text']! as String;
  var entities = List<TextEntity>.from(
    (_map["entities"] ?? []).map(
      (e) => TextEntity.fromMap(e),
    ),
  );
  return FormattedText(
    extra: extra,
    clientId: clientId,
    text: text,
    entities: entities,
  );
}