HotKey.fromJson constructor

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

Implementation

factory HotKey.fromJson(Map<String, dynamic> json) {
  return HotKey(
    KeyCodeParser.parse(json['keyCode']),
    modifiers: List<String>.from(json['modifiers'])
        .map((e) => KeyModifierParser.parse(e))
        .toList(),
    identifier: json['identifier'],
    scope: HotKeyScope.values.firstWhere(
      (e) => describeEnum(e) == json['scope'],
      orElse: () => HotKeyScope.system,
    ),
  );
}