| .. | .. |
|---|
| 3 | 3 | final int port; |
|---|
| 4 | 4 | final String? localHost; |
|---|
| 5 | 5 | final String? macAddress; |
|---|
| 6 | + final String? mqttToken; |
|---|
| 6 | 7 | |
|---|
| 7 | 8 | const ServerConfig({ |
|---|
| 8 | 9 | required this.host, |
|---|
| 9 | 10 | this.port = 8765, |
|---|
| 10 | 11 | this.localHost, |
|---|
| 11 | 12 | this.macAddress, |
|---|
| 13 | + this.mqttToken, |
|---|
| 12 | 14 | }); |
|---|
| 13 | 15 | |
|---|
| 14 | 16 | /// Primary WebSocket URL (local network). |
|---|
| .. | .. |
|---|
| 34 | 36 | 'port': port, |
|---|
| 35 | 37 | if (localHost != null) 'localHost': localHost, |
|---|
| 36 | 38 | if (macAddress != null) 'macAddress': macAddress, |
|---|
| 39 | + if (mqttToken != null) 'mqttToken': mqttToken, |
|---|
| 37 | 40 | }; |
|---|
| 38 | 41 | } |
|---|
| 39 | 42 | |
|---|
| .. | .. |
|---|
| 43 | 46 | port: json['port'] as int? ?? 8765, |
|---|
| 44 | 47 | localHost: json['localHost'] as String?, |
|---|
| 45 | 48 | macAddress: json['macAddress'] as String?, |
|---|
| 49 | + mqttToken: json['mqttToken'] as String?, |
|---|
| 46 | 50 | ); |
|---|
| 47 | 51 | } |
|---|
| 48 | 52 | |
|---|
| .. | .. |
|---|
| 51 | 55 | int? port, |
|---|
| 52 | 56 | String? localHost, |
|---|
| 53 | 57 | String? macAddress, |
|---|
| 58 | + String? mqttToken, |
|---|
| 54 | 59 | }) { |
|---|
| 55 | 60 | return ServerConfig( |
|---|
| 56 | 61 | host: host ?? this.host, |
|---|
| 57 | 62 | port: port ?? this.port, |
|---|
| 58 | 63 | localHost: localHost ?? this.localHost, |
|---|
| 59 | 64 | macAddress: macAddress ?? this.macAddress, |
|---|
| 65 | + mqttToken: mqttToken ?? this.mqttToken, |
|---|
| 60 | 66 | ); |
|---|
| 61 | 67 | } |
|---|
| 62 | 68 | } |
|---|