1 | | 0 | enum SquadronPlatformType { |
2 | | | unknown('Unknown'), |
3 | | | vm('Dart VM'), |
4 | | | js('JavaScript'), |
5 | | | wasm('Web Assembly'); |
6 | | |
|
7 | | | const SquadronPlatformType(this.label); |
8 | | |
|
9 | | | final String label; |
10 | | |
|
11 | | 4 | bool get isVm => this == vm; |
12 | | 8 | bool get isJs => this == js; |
13 | | 5 | bool get isWasm => this == wasm; |
14 | | 6 | bool get isWeb => isJs || isWasm; |
15 | | |
|
16 | | 2 | static SquadronPlatformType? tryParse(String label) { |
17 | | 3 | if (label == js.label) return js; |
18 | | 3 | if (label == wasm.label) return wasm; |
19 | | 2 | if (label == vm.label) return vm; |
20 | | 0 | if (label == unknown.label) return unknown; |
21 | | 0 | return null; |
22 | | 1 | } |
23 | | |
|
24 | | 10 | @override |
25 | | 10 | String toString() => label; |
26 | | 0 | } |