mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-02-23 11:35:26 +00:00
dart fix --apply --code=avoid_function_literals_in_foreach_calls
This commit is contained in:
parent
50ad945c17
commit
d4f9387e0c
9 changed files with 31 additions and 31 deletions
|
@ -169,15 +169,15 @@ class Site {
|
||||||
|
|
||||||
List<dynamic> rawUnsafeRoutes = json['unsafeRoutes'];
|
List<dynamic> rawUnsafeRoutes = json['unsafeRoutes'];
|
||||||
List<UnsafeRoute> unsafeRoutes = [];
|
List<UnsafeRoute> unsafeRoutes = [];
|
||||||
rawUnsafeRoutes.forEach((val) {
|
for (var val in rawUnsafeRoutes) {
|
||||||
unsafeRoutes.add(UnsafeRoute.fromJson(val));
|
unsafeRoutes.add(UnsafeRoute.fromJson(val));
|
||||||
});
|
}
|
||||||
|
|
||||||
List<dynamic> rawCA = json['ca'];
|
List<dynamic> rawCA = json['ca'];
|
||||||
List<CertificateInfo> ca = [];
|
List<CertificateInfo> ca = [];
|
||||||
rawCA.forEach((val) {
|
for (var val in rawCA) {
|
||||||
ca.add(CertificateInfo.fromJson(val));
|
ca.add(CertificateInfo.fromJson(val));
|
||||||
});
|
}
|
||||||
|
|
||||||
CertificateInfo? certInfo;
|
CertificateInfo? certInfo;
|
||||||
if (json['cert'] != null) {
|
if (json['cert'] != null) {
|
||||||
|
@ -186,9 +186,9 @@ class Site {
|
||||||
|
|
||||||
List<dynamic> rawErrors = json["errors"];
|
List<dynamic> rawErrors = json["errors"];
|
||||||
List<String> errors = [];
|
List<String> errors = [];
|
||||||
rawErrors.forEach((error) {
|
for (var error in rawErrors) {
|
||||||
errors.add(error);
|
errors.add(error);
|
||||||
});
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"name": json["name"],
|
"name": json["name"],
|
||||||
|
@ -295,9 +295,9 @@ class Site {
|
||||||
|
|
||||||
List<dynamic> f = jsonDecode(ret);
|
List<dynamic> f = jsonDecode(ret);
|
||||||
List<HostInfo> hosts = [];
|
List<HostInfo> hosts = [];
|
||||||
f.forEach((v) {
|
for (var v in f) {
|
||||||
hosts.add(HostInfo.fromJson(v));
|
hosts.add(HostInfo.fromJson(v));
|
||||||
});
|
}
|
||||||
|
|
||||||
return hosts;
|
return hosts;
|
||||||
} on PlatformException catch (err) {
|
} on PlatformException catch (err) {
|
||||||
|
@ -317,9 +317,9 @@ class Site {
|
||||||
|
|
||||||
List<dynamic> f = jsonDecode(ret);
|
List<dynamic> f = jsonDecode(ret);
|
||||||
List<HostInfo> hosts = [];
|
List<HostInfo> hosts = [];
|
||||||
f.forEach((v) {
|
for (var v in f) {
|
||||||
hosts.add(HostInfo.fromJson(v));
|
hosts.add(HostInfo.fromJson(v));
|
||||||
});
|
}
|
||||||
|
|
||||||
return hosts;
|
return hosts;
|
||||||
} on PlatformException catch (err) {
|
} on PlatformException catch (err) {
|
||||||
|
|
|
@ -10,9 +10,9 @@ class StaticHost {
|
||||||
var list = json['destinations'] as List<dynamic>;
|
var list = json['destinations'] as List<dynamic>;
|
||||||
var result = <IPAndPort>[];
|
var result = <IPAndPort>[];
|
||||||
|
|
||||||
list.forEach((item) {
|
for (var item in list) {
|
||||||
result.add(IPAndPort.fromString(item));
|
result.add(IPAndPort.fromString(item));
|
||||||
});
|
}
|
||||||
|
|
||||||
return StaticHost(lighthouse: json['lighthouse'], destinations: result);
|
return StaticHost(lighthouse: json['lighthouse'], destinations: result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
||||||
final double ipWidth =
|
final double ipWidth =
|
||||||
Utils.textSize("000.000.000.000:000000", CupertinoTheme.of(context).textTheme.textStyle).width;
|
Utils.textSize("000.000.000.000:000000", CupertinoTheme.of(context).textTheme.textStyle).width;
|
||||||
|
|
||||||
hostInfo.remoteAddresses.forEach((remoteObj) {
|
for (var remoteObj in hostInfo.remoteAddresses) {
|
||||||
String remote = remoteObj.toString();
|
String remote = remoteObj.toString();
|
||||||
items.add(
|
items.add(
|
||||||
ConfigCheckboxItem(
|
ConfigCheckboxItem(
|
||||||
|
@ -148,7 +148,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
return ConfigSection(label: items.isNotEmpty ? 'Tap to change the active address' : null, children: items);
|
return ConfigSection(label: items.isNotEmpty ? 'Tap to change the active address' : null, children: items);
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
||||||
final double ipWidth =
|
final double ipWidth =
|
||||||
Utils.textSize("000.000.000.000:000000", CupertinoTheme.of(context).textTheme.textStyle).width;
|
Utils.textSize("000.000.000.000:000000", CupertinoTheme.of(context).textTheme.textStyle).width;
|
||||||
|
|
||||||
hostInfo.remoteAddresses.forEach((remoteObj) {
|
for (var remoteObj in hostInfo.remoteAddresses) {
|
||||||
String remote = remoteObj.toString();
|
String remote = remoteObj.toString();
|
||||||
items.add(
|
items.add(
|
||||||
ConfigCheckboxItem(
|
ConfigCheckboxItem(
|
||||||
|
@ -169,7 +169,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
||||||
checked: currentRemote == remote,
|
checked: currentRemote == remote,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
return ConfigSection(label: items.isNotEmpty ? 'REMOTES' : null, children: items);
|
return ConfigSection(label: items.isNotEmpty ? 'REMOTES' : null, children: items);
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> items = [];
|
List<Widget> items = [];
|
||||||
sites!.forEach((site) {
|
for (var site in sites!) {
|
||||||
items.add(
|
items.add(
|
||||||
SiteItem(
|
SiteItem(
|
||||||
key: Key(site.id),
|
key: Key(site.id),
|
||||||
|
@ -223,7 +223,7 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
Widget child = ReorderableListView(
|
Widget child = ReorderableListView(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
|
|
@ -117,14 +117,14 @@ class _SiteDetailScreenState extends State<SiteDetailScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> items = [];
|
List<Widget> items = [];
|
||||||
site.errors.forEach((error) {
|
for (var error in site.errors) {
|
||||||
items.add(
|
items.add(
|
||||||
ConfigItem(
|
ConfigItem(
|
||||||
labelWidth: 0,
|
labelWidth: 0,
|
||||||
content: Padding(padding: EdgeInsets.symmetric(vertical: 10), child: SelectableText(error)),
|
content: Padding(padding: EdgeInsets.symmetric(vertical: 10), child: SelectableText(error)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
return ConfigSection(
|
return ConfigSection(
|
||||||
label: 'ERRORS',
|
label: 'ERRORS',
|
||||||
|
|
|
@ -39,9 +39,9 @@ class _CAListScreenState extends State<CAListScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
widget.cas.forEach((ca) {
|
for (var ca in widget.cas) {
|
||||||
cas[ca.cert.fingerprint] = ca;
|
cas[ca.cert.fingerprint] = ca;
|
||||||
});
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -115,14 +115,14 @@ class _CAListScreenState extends State<CAListScreen> {
|
||||||
var ignored = 0;
|
var ignored = 0;
|
||||||
|
|
||||||
List<dynamic> certs = jsonDecode(rawCerts);
|
List<dynamic> certs = jsonDecode(rawCerts);
|
||||||
certs.forEach((rawCert) {
|
for (var rawCert in certs) {
|
||||||
final info = CertificateInfo.fromJson(rawCert);
|
final info = CertificateInfo.fromJson(rawCert);
|
||||||
if (!info.cert.details.isCa) {
|
if (!info.cert.details.isCa) {
|
||||||
ignored++;
|
ignored++;
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
cas[info.cert.fingerprint] = info;
|
cas[info.cert.fingerprint] = info;
|
||||||
});
|
}
|
||||||
|
|
||||||
if (ignored > 0) {
|
if (ignored > 0) {
|
||||||
error = 'One or more certificates were ignored because they were not certificate authorities.';
|
error = 'One or more certificates were ignored because they were not certificate authorities.';
|
||||||
|
|
|
@ -163,11 +163,11 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
|
||||||
if (!site.managed) {
|
if (!site.managed) {
|
||||||
caError = site.ca.isEmpty;
|
caError = site.ca.isEmpty;
|
||||||
if (!caError) {
|
if (!caError) {
|
||||||
site.ca.forEach((ca) {
|
for (var ca in site.ca) {
|
||||||
if (ca.validity == null || !ca.validity!.valid) {
|
if (ca.validity == null || !ca.validity!.valid) {
|
||||||
caError = true;
|
caError = true;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ class _StaticHostmapScreenState extends State<StaticHostmapScreen> {
|
||||||
_nebulaIp = widget.nebulaIp;
|
_nebulaIp = widget.nebulaIp;
|
||||||
_lighthouse = widget.lighthouse;
|
_lighthouse = widget.lighthouse;
|
||||||
_destinations = {};
|
_destinations = {};
|
||||||
widget.destinations.forEach((dest) {
|
for (var dest in widget.destinations) {
|
||||||
_destinations[UniqueKey()] = _IPAndPort(focusNode: FocusNode(), destination: dest);
|
_destinations[UniqueKey()] = _IPAndPort(focusNode: FocusNode(), destination: dest);
|
||||||
});
|
}
|
||||||
|
|
||||||
if (_destinations.isEmpty) {
|
if (_destinations.isEmpty) {
|
||||||
_addDestination();
|
_addDestination();
|
||||||
|
|
|
@ -24,9 +24,9 @@ class _UnsafeRoutesScreenState extends State<UnsafeRoutesScreen> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
unsafeRoutes = {};
|
unsafeRoutes = {};
|
||||||
widget.unsafeRoutes.forEach((route) {
|
for (var route in widget.unsafeRoutes) {
|
||||||
unsafeRoutes[UniqueKey()] = route;
|
unsafeRoutes[UniqueKey()] = route;
|
||||||
});
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue