mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-01-24 13:41:09 -05:00
better casts
This commit is contained in:
parent
6de2432c53
commit
11d621c9be
@ -21,7 +21,7 @@ class ValueSubkeyRange extends Equatable {
|
|||||||
return ValueSubkeyRange(low: intlist[0], high: intlist[1]);
|
return ValueSubkeyRange(low: intlist[0], high: intlist[1]);
|
||||||
}
|
}
|
||||||
factory ValueSubkeyRange.fromJson(dynamic json) =>
|
factory ValueSubkeyRange.fromJson(dynamic json) =>
|
||||||
ValueSubkeyRange.fromIntList(json as List<int>);
|
ValueSubkeyRange.fromIntList((json as List<dynamic>).cast<int>());
|
||||||
|
|
||||||
List<int> toJson() => <int>[low, high];
|
List<int> toJson() => <int>[low, high];
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ Object? veilidApiToEncodable(Object? value) {
|
|||||||
|
|
||||||
List<T> Function(dynamic) jsonListConstructor<T>(
|
List<T> Function(dynamic) jsonListConstructor<T>(
|
||||||
T Function(dynamic) jsonConstructor) =>
|
T Function(dynamic) jsonConstructor) =>
|
||||||
(dynamic j) => (j as List<dynamic>).map((e) => jsonConstructor(e)).toList();
|
(dynamic j) => (j as List<dynamic>).map(jsonConstructor).toList();
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
/// VeilidVersion
|
/// VeilidVersion
|
||||||
|
@ -1630,7 +1630,7 @@ class VeilidFFI extends Veilid {
|
|||||||
final vckString = _validCryptoKinds();
|
final vckString = _validCryptoKinds();
|
||||||
final vck = jsonDecode(vckString.toDartString()) as List<dynamic>;
|
final vck = jsonDecode(vckString.toDartString()) as List<dynamic>;
|
||||||
_freeString(vckString);
|
_freeString(vckString);
|
||||||
return vck.map((v) => v as CryptoKind).toList();
|
return vck.cast<CryptoKind>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -597,7 +597,7 @@ class VeilidJS extends Veilid {
|
|||||||
List<CryptoKind> validCryptoKinds() {
|
List<CryptoKind> validCryptoKinds() {
|
||||||
final vck = jsonDecode(js_util.callMethod(wasm, 'valid_crypto_kinds', []))
|
final vck = jsonDecode(js_util.callMethod(wasm, 'valid_crypto_kinds', []))
|
||||||
as List<dynamic>;
|
as List<dynamic>;
|
||||||
return vck.map((v) => v as CryptoKind).toList();
|
return vck.cast<CryptoKind>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Loading…
Reference in New Issue
Block a user