fromMap static method

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

Construct from Map.

Implementation

static SetCommands? 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 scope = BotCommandScope.fromMap(_map['scope']);
  var language_code = _map['language_code'] as String?;
  var commands = List<BotCommand>.from(
    (_map["commands"] ?? []).map(
      (e) => BotCommand.fromMap(e),
    ),
  );
  return SetCommands(
    extra: extra,
    clientId: clientId,
    scope: scope,
    language_code: language_code,
    commands: commands,
  );
}