fix: idtyIndex is nullable

This commit is contained in:
poka 2023-11-24 16:31:34 +01:00
parent a13d19177b
commit a35d6b5cf2
2 changed files with 4 additions and 4 deletions

View File

@ -169,7 +169,7 @@ class SubstrateSdk with ChangeNotifier {
final idtyIndexFrom = await _getIdentityIndexOf(from); final idtyIndexFrom = await _getIdentityIndexOf(from);
final idtyIndexTo = await _getIdentityIndexOf(to); final idtyIndexTo = await _getIdentityIndexOf(to);
if (idtyIndexFrom == 0 || idtyIndexTo == 0) return 0; if (idtyIndexFrom == null || idtyIndexTo == null) return 0;
final List certData = final List certData =
await _getStorage('cert.certsByReceiver($idtyIndexTo)') ?? []; await _getStorage('cert.certsByReceiver($idtyIndexTo)') ?? [];
@ -362,7 +362,7 @@ class SubstrateSdk with ChangeNotifier {
// Provider.of<WalletOptionsProvider>(homeContext, listen: false); // Provider.of<WalletOptionsProvider>(homeContext, listen: false);
var idtyIndex = await _getIdentityIndexOf(address); var idtyIndex = await _getIdentityIndexOf(address);
if (idtyIndex == 0) return []; if (idtyIndex == null) return [];
final Map? idtyData = await _getStorage('identity.identities($idtyIndex)'); final Map? idtyData = await _getStorage('identity.identities($idtyIndex)');
if (idtyData == null || idtyData['oldOwnerKey'] == null) return []; if (idtyData == null || idtyData['oldOwnerKey'] == null) return [];

View File

@ -194,7 +194,7 @@ class WalletViewScreen extends StatelessWidget {
} }
} }
final toStatus = snapshot.data!['toStatus'] ?? 0; final toStatus = snapshot.data!['toStatus'];
return Visibility( return Visibility(
visible: (snapshot.data != {}), visible: (snapshot.data != {}),
@ -272,7 +272,7 @@ class WalletViewScreen extends StatelessWidget {
), ),
const SizedBox(height: 9), const SizedBox(height: 9),
Text( Text(
toStatus == 0 toStatus == null
? "certify".tr() ? "certify".tr()
: "createIdentity".tr(), : "createIdentity".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,