mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-02-22 19:15:27 +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<UnsafeRoute> unsafeRoutes = [];
|
||||
rawUnsafeRoutes.forEach((val) {
|
||||
for (var val in rawUnsafeRoutes) {
|
||||
unsafeRoutes.add(UnsafeRoute.fromJson(val));
|
||||
});
|
||||
}
|
||||
|
||||
List<dynamic> rawCA = json['ca'];
|
||||
List<CertificateInfo> ca = [];
|
||||
rawCA.forEach((val) {
|
||||
for (var val in rawCA) {
|
||||
ca.add(CertificateInfo.fromJson(val));
|
||||
});
|
||||
}
|
||||
|
||||
CertificateInfo? certInfo;
|
||||
if (json['cert'] != null) {
|
||||
|
@ -186,9 +186,9 @@ class Site {
|
|||
|
||||
List<dynamic> rawErrors = json["errors"];
|
||||
List<String> errors = [];
|
||||
rawErrors.forEach((error) {
|
||||
for (var error in rawErrors) {
|
||||
errors.add(error);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
"name": json["name"],
|
||||
|
@ -295,9 +295,9 @@ class Site {
|
|||
|
||||
List<dynamic> f = jsonDecode(ret);
|
||||
List<HostInfo> hosts = [];
|
||||
f.forEach((v) {
|
||||
for (var v in f) {
|
||||
hosts.add(HostInfo.fromJson(v));
|
||||
});
|
||||
}
|
||||
|
||||
return hosts;
|
||||
} on PlatformException catch (err) {
|
||||
|
@ -317,9 +317,9 @@ class Site {
|
|||
|
||||
List<dynamic> f = jsonDecode(ret);
|
||||
List<HostInfo> hosts = [];
|
||||
f.forEach((v) {
|
||||
for (var v in f) {
|
||||
hosts.add(HostInfo.fromJson(v));
|
||||
});
|
||||
}
|
||||
|
||||
return hosts;
|
||||
} on PlatformException catch (err) {
|
||||
|
|
|
@ -10,9 +10,9 @@ class StaticHost {
|
|||
var list = json['destinations'] as List<dynamic>;
|
||||
var result = <IPAndPort>[];
|
||||
|
||||
list.forEach((item) {
|
||||
for (var item in list) {
|
||||
result.add(IPAndPort.fromString(item));
|
||||
});
|
||||
}
|
||||
|
||||
return StaticHost(lighthouse: json['lighthouse'], destinations: result);
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
|||
final double ipWidth =
|
||||
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();
|
||||
items.add(
|
||||
ConfigCheckboxItem(
|
||||
|
@ -148,7 +148,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
|||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
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 =
|
||||
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();
|
||||
items.add(
|
||||
ConfigCheckboxItem(
|
||||
|
@ -169,7 +169,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
|||
checked: currentRemote == remote,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return ConfigSection(label: items.isNotEmpty ? 'REMOTES' : null, children: items);
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ class _MainScreenState extends State<MainScreen> {
|
|||
}
|
||||
|
||||
List<Widget> items = [];
|
||||
sites!.forEach((site) {
|
||||
for (var site in sites!) {
|
||||
items.add(
|
||||
SiteItem(
|
||||
key: Key(site.id),
|
||||
|
@ -223,7 +223,7 @@ class _MainScreenState extends State<MainScreen> {
|
|||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget child = ReorderableListView(
|
||||
shrinkWrap: true,
|
||||
|
|
|
@ -117,14 +117,14 @@ class _SiteDetailScreenState extends State<SiteDetailScreen> {
|
|||
}
|
||||
|
||||
List<Widget> items = [];
|
||||
site.errors.forEach((error) {
|
||||
for (var error in site.errors) {
|
||||
items.add(
|
||||
ConfigItem(
|
||||
labelWidth: 0,
|
||||
content: Padding(padding: EdgeInsets.symmetric(vertical: 10), child: SelectableText(error)),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return ConfigSection(
|
||||
label: 'ERRORS',
|
||||
|
|
|
@ -39,9 +39,9 @@ class _CAListScreenState extends State<CAListScreen> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
widget.cas.forEach((ca) {
|
||||
for (var ca in widget.cas) {
|
||||
cas[ca.cert.fingerprint] = ca;
|
||||
});
|
||||
}
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
@ -115,14 +115,14 @@ class _CAListScreenState extends State<CAListScreen> {
|
|||
var ignored = 0;
|
||||
|
||||
List<dynamic> certs = jsonDecode(rawCerts);
|
||||
certs.forEach((rawCert) {
|
||||
for (var rawCert in certs) {
|
||||
final info = CertificateInfo.fromJson(rawCert);
|
||||
if (!info.cert.details.isCa) {
|
||||
ignored++;
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
cas[info.cert.fingerprint] = info;
|
||||
});
|
||||
}
|
||||
|
||||
if (ignored > 0) {
|
||||
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) {
|
||||
caError = site.ca.isEmpty;
|
||||
if (!caError) {
|
||||
site.ca.forEach((ca) {
|
||||
for (var ca in site.ca) {
|
||||
if (ca.validity == null || !ca.validity!.valid) {
|
||||
caError = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ class _StaticHostmapScreenState extends State<StaticHostmapScreen> {
|
|||
_nebulaIp = widget.nebulaIp;
|
||||
_lighthouse = widget.lighthouse;
|
||||
_destinations = {};
|
||||
widget.destinations.forEach((dest) {
|
||||
for (var dest in widget.destinations) {
|
||||
_destinations[UniqueKey()] = _IPAndPort(focusNode: FocusNode(), destination: dest);
|
||||
});
|
||||
}
|
||||
|
||||
if (_destinations.isEmpty) {
|
||||
_addDestination();
|
||||
|
|
|
@ -24,9 +24,9 @@ class _UnsafeRoutesScreenState extends State<UnsafeRoutesScreen> {
|
|||
@override
|
||||
void initState() {
|
||||
unsafeRoutes = {};
|
||||
widget.unsafeRoutes.forEach((route) {
|
||||
for (var route in widget.unsafeRoutes) {
|
||||
unsafeRoutes[UniqueKey()] = route;
|
||||
});
|
||||
}
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue