Use this.id

This commit is contained in:
Ian VanSchooten 2024-10-29 12:02:08 -04:00
parent 60dd6dacaa
commit 9e403b8710
1 changed files with 14 additions and 16 deletions

View File

@ -93,22 +93,20 @@ class Site {
this.rawConfig = rawConfig; this.rawConfig = rawConfig;
this.lastManagedUpdate = lastManagedUpdate; this.lastManagedUpdate = lastManagedUpdate;
if (id != null) { _updates = EventChannel('net.defined.nebula/${this.id}');
_updates = EventChannel('net.defined.nebula/$id'); _updates.receiveBroadcastStream().listen((d) {
_updates.receiveBroadcastStream().listen((d) { try {
try { _updateFromJson(d);
_updateFromJson(d); _change.add(null);
_change.add(null); } catch (err) {
} catch (err) { //TODO: handle the error
//TODO: handle the error print(err);
print(err); }
} }, onError: (err) {
}, onError: (err) { _updateFromJson(err.details);
_updateFromJson(err.details); var error = err as PlatformException;
var error = err as PlatformException; _change.addError(error.message ?? 'An unexpected error occurred');
_change.addError(error.message ?? 'An unexpected error occurred'); });
});
}
} }
factory Site.fromJson(Map<String, dynamic> json) { factory Site.fromJson(Map<String, dynamic> json) {