Use the parameter initializing shorthand instead of doing it in the constructor

This commit is contained in:
Caleb Jasik 2025-03-04 10:55:47 -06:00
parent 4f9e9f191d
commit dabcde4ee3
No known key found for this signature in database

View file

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:mobile_nebula/models/HostInfo.dart'; import 'package:mobile_nebula/models/HostInfo.dart';
import 'package:mobile_nebula/models/UnsafeRoute.dart'; import 'package:mobile_nebula/models/UnsafeRoute.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'Certificate.dart'; import 'Certificate.dart';
import 'StaticHosts.dart'; import 'StaticHosts.dart';
@ -53,45 +54,31 @@ class Site {
late List<String> errors; late List<String> errors;
Site({ Site({
String name = '', this.name = '',
String? id, String? id,
Map<String, StaticHost>? staticHostmap, Map<String, StaticHost>? staticHostmap,
List<CertificateInfo>? ca, List<CertificateInfo>? ca,
CertificateInfo? certInfo, this.certInfo,
int lhDuration = 0, this.lhDuration = 0,
int port = 0, this.port = 0,
String cipher = "aes", this.cipher = "aes",
int sortKey = 0, this.sortKey = 0,
int mtu = 1300, this.mtu = 1300,
bool connected = false, this.connected = false,
String status = '', this.status = '',
String logFile = '', this.logFile = '',
String logVerbosity = 'info', this.logVerbosity = 'info',
List<String>? errors, List<String>? errors,
List<UnsafeRoute>? unsafeRoutes, List<UnsafeRoute>? unsafeRoutes,
bool managed = false, this.managed = false,
String? rawConfig, this.rawConfig,
DateTime? lastManagedUpdate, this.lastManagedUpdate,
}) { }) {
this.name = name;
this.id = id ?? uuid.v4(); this.id = id ?? uuid.v4();
this.staticHostmap = staticHostmap ?? {}; this.staticHostmap = staticHostmap ?? {};
this.ca = ca ?? []; this.ca = ca ?? [];
this.certInfo = certInfo;
this.lhDuration = lhDuration;
this.port = port;
this.cipher = cipher;
this.sortKey = sortKey;
this.mtu = mtu;
this.connected = connected;
this.status = status;
this.logFile = logFile;
this.logVerbosity = logVerbosity;
this.errors = errors ?? []; this.errors = errors ?? [];
this.unsafeRoutes = unsafeRoutes ?? []; this.unsafeRoutes = unsafeRoutes ?? [];
this.managed = managed;
this.rawConfig = rawConfig;
this.lastManagedUpdate = lastManagedUpdate;
_updates = EventChannel('net.defined.nebula/${this.id}'); _updates = EventChannel('net.defined.nebula/${this.id}');
_updates.receiveBroadcastStream().listen( _updates.receiveBroadcastStream().listen(