diff --git a/demo/app/analysis_options.yaml b/demo/app/analysis_options.yaml index 61b6c4de..1caa1fad 100644 --- a/demo/app/analysis_options.yaml +++ b/demo/app/analysis_options.yaml @@ -23,7 +23,7 @@ linter: # producing the lint. rules: # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/demo/app/integration_test/openid4ci_test.dart b/demo/app/integration_test/openid4ci_test.dart index bca882ab..21c8983b 100644 --- a/demo/app/integration_test/openid4ci_test.dart +++ b/demo/app/integration_test/openid4ci_test.dart @@ -12,59 +12,59 @@ import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; void main() async { - print("Init Wallet SDK Plugin"); + print('Init Wallet SDK Plugin'); final walletSDKPlugin = WalletSDK(); - print("Init SDK"); - const didResolverURI = String.fromEnvironment("DID_RESOLVER_URI"); + print('Init SDK'); + const didResolverURI = String.fromEnvironment('DID_RESOLVER_URI'); await walletSDKPlugin.initSDK(didResolverURI); - var didKeyType = ""; + var didKeyType = ''; testWidgets('Testing openid4vc with a single credential', (tester) async { - const didMethodTypes = String.fromEnvironment("WALLET_DID_METHODS"); + const didMethodTypes = String.fromEnvironment('WALLET_DID_METHODS'); var didMethodTypesList = didMethodTypes.split(' '); - const issuanceURLs = String.fromEnvironment("INITIATE_ISSUANCE_URLS"); + const issuanceURLs = String.fromEnvironment('INITIATE_ISSUANCE_URLS'); var issuanceURLsList = issuanceURLs.split(' '); - const verificationURLs = String.fromEnvironment("INITIATE_VERIFICATION_URLS"); + const verificationURLs = String.fromEnvironment('INITIATE_VERIFICATION_URLS'); var verificationURLsList = verificationURLs.split(' '); for (int i = 0; i < issuanceURLsList.length; i++) { String didMethodType = didMethodTypesList[i]; - print("wallet DID Type : $didMethodType"); - print("wallet DID Key Type : $didKeyType"); + print('wallet DID Type : $didMethodType'); + print('wallet DID Key Type : $didKeyType'); var didDocData = await walletSDKPlugin.createDID(didMethodTypesList[i], didKeyType); final didContent= didDocData.did; - print("wallet DID : $didContent"); + print('wallet DID : $didContent'); String issuanceURL = issuanceURLsList[i]; - print("issuanceURL : $issuanceURL"); + print('issuanceURL : $issuanceURL'); var initializeResp = await walletSDKPlugin.initialize(issuanceURL, null); var initializeRespEncoded = json.encode(initializeResp!); Map initializeRespJson = json.decode(initializeRespEncoded); - var requirePIN = initializeRespJson["pinRequired"]; - print("requirePIN: $requirePIN"); + var requirePIN = initializeRespJson['pinRequired']; + print('requirePIN: $requirePIN'); - final credential = await walletSDKPlugin.requestCredential(""); - debugPrint("content: $credential"); + final credential = await walletSDKPlugin.requestCredential(''); + debugPrint('content: $credential'); for (final p in credential.split('.')) { - print("----"); + print('----'); print(p); } expect(credential, hasLength(greaterThan(0))); String verificationURL = verificationURLsList[i]; - print("verificationURL : $verificationURL"); + print('verificationURL : $verificationURL'); await walletSDKPlugin .processAuthorizationRequest(authorizationRequest: verificationURL); - print("getSubmissionRequirements"); + print('getSubmissionRequirements'); final requirements = await walletSDKPlugin.getSubmissionRequirements( storedCredentials: [credential]); - print("getSubmissionRequirements finished"); + print('getSubmissionRequirements finished'); expect(requirements, hasLength(equals(1))); expect(requirements[0].inputDescriptors, hasLength(equals(1))); @@ -75,16 +75,16 @@ void main() async { }); testWidgets('Testing openid4vc with multiple credentials', (tester) async { - const didMethodTypes = String.fromEnvironment("WALLET_DID_METHODS"); + const didMethodTypes = String.fromEnvironment('WALLET_DID_METHODS'); var didMethodTypesList = didMethodTypes.split(' '); String didMethodType = didMethodTypesList[0]; - print("wallet DID type : $didMethodType"); - print("wallet DID Key type : $didKeyType"); + print('wallet DID type : $didMethodType'); + print('wallet DID Key type : $didKeyType'); var didDocData = await walletSDKPlugin.createDID(didMethodTypesList[0], didKeyType); var didContent= didDocData.did; - print("wallet DID : $didContent"); + print('wallet DID : $didContent'); - const issuanceURLs = String.fromEnvironment("INITIATE_ISSUANCE_URLS_MULTIPLE_CREDS"); + const issuanceURLs = String.fromEnvironment('INITIATE_ISSUANCE_URLS_MULTIPLE_CREDS'); var issuanceURLsList = issuanceURLs.split(' '); List credentials = []; @@ -92,31 +92,31 @@ void main() async { // Issue multiple credentials for (int i = 0; i < issuanceURLsList.length; i++) { String issuanceURL = issuanceURLsList[i]; - print("issuanceURL : $issuanceURL"); + print('issuanceURL : $issuanceURL'); var initializeResp = await walletSDKPlugin.initialize(issuanceURL, null); var initializeRespEncoded = json.encode(initializeResp!); Map initializeRespJson = json.decode(initializeRespEncoded); - var requirePIN = initializeRespJson["pinRequired"]; - print("requirePIN: $requirePIN"); + var requirePIN = initializeRespJson['pinRequired']; + print('requirePIN: $requirePIN'); - final credential = await walletSDKPlugin.requestCredential(""); + final credential = await walletSDKPlugin.requestCredential(''); expect(credential, hasLength(greaterThan(0))); credentials.add(credential); } - print("issued credentials: $credentials"); + print('issued credentials: $credentials'); - const verificationURLs = String.fromEnvironment("INITIATE_VERIFICATION_URLS_MULTIPLE_CREDS"); + const verificationURLs = String.fromEnvironment('INITIATE_VERIFICATION_URLS_MULTIPLE_CREDS'); var verificationURLsList = verificationURLs.split(' '); String verificationURL = verificationURLsList[0]; - print("verificationURL : $verificationURL"); + print('verificationURL : $verificationURL'); final matchedCreds = await walletSDKPlugin .processAuthorizationRequest(authorizationRequest: verificationURL, storedCredentials: credentials); - print("matchedCreds : $matchedCreds"); + print('matchedCreds : $matchedCreds'); expect(matchedCreds, hasLength(equals(3))); @@ -128,32 +128,32 @@ void main() async { }); testWidgets('Testing openid4vc with the auth code flow', (tester) async { - const didMethodTypes = String.fromEnvironment("WALLET_DID_METHODS"); + const didMethodTypes = String.fromEnvironment('WALLET_DID_METHODS'); var didMethodTypesList = didMethodTypes.split(' '); String didMethodType = didMethodTypesList[0]; - print("wallet DID type : $didMethodType"); - print("wallet DID Key type : $didKeyType"); + print('wallet DID type : $didMethodType'); + print('wallet DID Key type : $didKeyType'); var didDocData = await walletSDKPlugin.createDID(didMethodTypesList[0], didKeyType); - print("wallet didDocData : $didDocData"); + print('wallet didDocData : $didDocData'); var didContent= didDocData.did; - print("wallet DID : $didContent"); + print('wallet DID : $didContent'); - const issuanceURL = String.fromEnvironment("INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW"); - debugPrint("issuanceURLs: $issuanceURL"); + const issuanceURL = String.fromEnvironment('INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW'); + debugPrint('issuanceURLs: $issuanceURL'); var authCodeArgs = { - "scopes": ["openid","profile"], - "clientID": "oidc4vc_client", - "redirectURI": "http://127.0.0.1/callback" + 'scopes': ['openid','profile'], + 'clientID': 'oidc4vc_client', + 'redirectURI': 'http://127.0.0.1/callback' }; var initializeResp = await walletSDKPlugin.initialize(issuanceURL, authCodeArgs); var initializeRespEncoded = json.encode(initializeResp!); Map initializeRespJson = json.decode(initializeRespEncoded); - var authorizationURLLink= initializeRespJson["authorizationURLLink"]; - debugPrint("authorizationURLLink: $authorizationURLLink"); + var authorizationURLLink= initializeRespJson['authorizationURLLink']; + debugPrint('authorizationURLLink: $authorizationURLLink'); // fetching redirect uri - var redirectURI; + String redirectURI = ''; final client = HttpClient(); var redirectUrl = Uri.parse(authorizationURLLink); var request = await client.getUrl(redirectUrl); @@ -164,14 +164,14 @@ void main() async { final location = response.headers.value(HttpHeaders.locationHeader); if (location != null) { redirectUrl = redirectUrl.resolve(location); - if (location.contains("http://127.0.0.1/callback")) + if (location.contains('http://127.0.0.1/callback')) { redirectURI = location; break; } - if (redirectUrl.host.contains("cognito-mock.trustbloc.local")){ - redirectUrl = Uri.parse(redirectUrl.toString().replaceAll("cognito-mock.trustbloc.local", "localhost")); - print("uri updated $redirectUrl"); + if (redirectUrl.host.contains('cognito-mock.trustbloc.local')){ + redirectUrl = Uri.parse(redirectUrl.toString().replaceAll('cognito-mock.trustbloc.local', 'localhost')); + print('uri updated $redirectUrl'); } request = await client.getUrl(redirectUrl); request.followRedirects = false; @@ -179,12 +179,12 @@ void main() async { } } - debugPrint("redirectURI $redirectURI"); + debugPrint('redirectURI $redirectURI'); final credential = await walletSDKPlugin.requestCredentialWithAuth(redirectURI); - debugPrint("content: $credential"); + debugPrint('content: $credential'); for (final p in credential.split('.')) { - print("----"); + print('----'); print(p); } diff --git a/demo/app/lib/main.dart b/demo/app/lib/main.dart index 86e7b5a1..21763cbe 100644 --- a/demo/app/lib/main.dart +++ b/demo/app/lib/main.dart @@ -4,7 +4,6 @@ Copyright Gen Digital Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -import 'dart:io'; import 'package:app/scenarios/handle_openid_url.dart'; import 'package:app/widgets/common_logo_appbar.dart'; @@ -22,7 +21,7 @@ final WalletSDKPlugin = WalletSDK(); void main() async { WidgetsFlutterBinding.ensureInitialized(); - const didResolverURI = String.fromEnvironment("didResolverURI"); + const didResolverURI = String.fromEnvironment('didResolverURI'); await WalletSDKPlugin.initSDK(didResolverURI); runApp(const MyApp()); diff --git a/demo/app/lib/models/store_credential_data.dart b/demo/app/lib/models/store_credential_data.dart index 30ef9a0d..38065c85 100644 --- a/demo/app/lib/models/store_credential_data.dart +++ b/demo/app/lib/models/store_credential_data.dart @@ -16,7 +16,7 @@ class UserLoginDetails { Future getUser() async { SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences p = prefs; - String? userLoggedIn = p.getString("userLoggedIn"); - print("userLoginDetails -> $userLoggedIn"); + String? userLoggedIn = p.getString('userLoggedIn'); + print('userLoginDetails -> $userLoggedIn'); return UserLoginDetails(userLoggedIn); } diff --git a/demo/app/lib/scenarios/handle_openid_issuance_flow.dart b/demo/app/lib/scenarios/handle_openid_issuance_flow.dart index 1e32a8a4..91ef6202 100644 --- a/demo/app/lib/scenarios/handle_openid_issuance_flow.dart +++ b/demo/app/lib/scenarios/handle_openid_issuance_flow.dart @@ -18,23 +18,23 @@ import '../views/custom_error.dart'; void handleOpenIDIssuanceFlow(BuildContext context, String qrCodeURL) async { var WalletSDKPlugin = WalletSDK(); var authCodeArgs; - if (qrCodeURL.contains("credential_offer_uri")) { + if (qrCodeURL.contains('credential_offer_uri')) { authCodeArgs = await parseCredentialOfferUri(qrCodeURL); - log("credential offer uri auth code ${authCodeArgs}"); + log('credential offer uri auth code $authCodeArgs'); } else { - if (qrCodeURL.contains("authorization_code")) { + if (qrCodeURL.contains('authorization_code')) { authCodeArgs = await readIssuerAuthFlowConfig(qrCodeURL); - log("auth code arguments fetched from config file $authCodeArgs"); + log('auth code arguments fetched from config file $authCodeArgs'); // While fetching auth code args based on issuer key from file, if no key-value pair is found then set the // arguments to default scope and redirect url. authCodeArgs ??= { - "scopes": ["openid", "profile"], - "redirectURI": "trustbloc-wallet://openid4vci/authcodeflow/callback" + 'scopes': ['openid', 'profile'], + 'redirectURI': 'trustbloc-wallet://openid4vci/authcodeflow/callback' }; } } - log("qr code url - $qrCodeURL"); - var flowTypeData; + log('qr code url - $qrCodeURL'); + Map? flowTypeData; try { flowTypeData = await WalletSDKPlugin.initialize(qrCodeURL, authCodeArgs); } catch (error) { @@ -43,22 +43,22 @@ void handleOpenIDIssuanceFlow(BuildContext context, String qrCodeURL) async { context, MaterialPageRoute( builder: (context) => CustomError( - titleBar: "QR Code Scanned", - requestErrorTitleMsg: "error while intializing the interaction", - requestErrorSubTitleMsg: "${errString}"))); + titleBar: 'QR Code Scanned', + requestErrorTitleMsg: 'error while intializing the interaction', + requestErrorSubTitleMsg: errString))); return; } var flowTypeDataEncoded = json.encode(flowTypeData); Map responseJson = json.decode(flowTypeDataEncoded); - var authorizeResultPinRequired = responseJson["pinRequired"]; - log("pin required flow - $authorizeResultPinRequired"); + var authorizeResultPinRequired = responseJson['pinRequired']; + log('pin required flow - $authorizeResultPinRequired'); if (authorizeResultPinRequired == true) { navigateToIssuancePreviewScreen(context, authorizeResultPinRequired); return; - } else if (responseJson["authorizationURLLink"] != '') { + } else if (responseJson['authorizationURLLink'] != '') { // initiate authCode Flow log("initiating authCode Flow- ${responseJson["authorizationURLLink"]}"); - Uri uri = Uri.parse(responseJson["authorizationURLLink"]); + Uri uri = Uri.parse(responseJson['authorizationURLLink']); navigateToIssuancePreviewScreenAuthFlow(context, uri); return; } else { @@ -70,10 +70,10 @@ void handleOpenIDIssuanceFlow(BuildContext context, String qrCodeURL) async { readIssuerAuthFlowConfig(String qrCodeURL) async { var decodedUri = Uri.decodeComponent(qrCodeURL); final uri = Uri.parse(decodedUri); - var credentialIssuerKey = json.decode(uri.queryParameters["credential_offer"]!); + var credentialIssuerKey = json.decode(uri.queryParameters['credential_offer']!); final String response = await rootBundle.loadString('lib/assets/issuerAuthFlowConfig.json'); final configData = await json.decode(response); - return configData[credentialIssuerKey["credential_issuer"]]; + return configData[credentialIssuerKey['credential_issuer']]; } parseCredentialOfferUri(String qrCodeURL) async { diff --git a/demo/app/lib/scenarios/handle_openid_url.dart b/demo/app/lib/scenarios/handle_openid_url.dart index 95e7edbc..b04c0335 100644 --- a/demo/app/lib/scenarios/handle_openid_url.dart +++ b/demo/app/lib/scenarios/handle_openid_url.dart @@ -5,7 +5,6 @@ SPDX-License-Identifier: Apache-2.0 */ import 'dart:developer'; -import 'package:app/wallet_sdk/wallet_sdk.dart'; import 'package:app/scenarios/handle_openid_issuance_flow.dart'; import 'package:app/scenarios/handle_openid_vp_flow.dart'; import 'package:app/wallet_sdk/wallet_sdk_model.dart'; @@ -14,7 +13,7 @@ import 'package:flutter/material.dart'; void handleOpenIDUrl(BuildContext context, String qrCodeURL) async { log('received qr code url - $qrCodeURL'); // Check if the flow is for the verifiable presentation or for issuance. - if (!qrCodeURL.contains("openid-vc")) { + if (!qrCodeURL.contains('openid-vc')) { handleOpenIDIssuanceFlow(context, qrCodeURL); } else { handleOpenIDVpFlow(context, qrCodeURL); diff --git a/demo/app/lib/scenarios/handle_openid_vp_flow.dart b/demo/app/lib/scenarios/handle_openid_vp_flow.dart index 77641095..5357f701 100644 --- a/demo/app/lib/scenarios/handle_openid_vp_flow.dart +++ b/demo/app/lib/scenarios/handle_openid_vp_flow.dart @@ -39,7 +39,7 @@ void handleOpenIDVpFlow(BuildContext context, String qrCodeURL) async { context, MaterialPageRoute( builder: (context) => - CustomError(titleBar: "Processing Presentation", requestErrorTitleMsg: error.message!, requestErrorSubTitleMsg: error.details))); + CustomError(titleBar: 'Processing Presentation', requestErrorTitleMsg: error.message!, requestErrorSubTitleMsg: error.details))); } // Get the matched VCIDs from the submission request. var getSubmissionRequest = await walletSDKPlugin.getSubmissionRequirements(storedCredentials: credentials); @@ -48,10 +48,10 @@ void handleOpenIDVpFlow(BuildContext context, String qrCodeURL) async { // multiple matched vc ids are found therefore, invoking multiple credential Presentation Preview. List credentialDisplayDataList = []; for (var cred in credentials) { - log("multi cred flow $submission and ${credentials.length}"); + log('multi cred flow $submission and ${credentials.length}'); for (var inputDescriptor in submission.inputDescriptors) { Map payload = Jwt.parseJwt(cred); - if (inputDescriptor.matchedVCsID.contains(payload["jti"])) { + if (inputDescriptor.matchedVCsID.contains(payload['jti'])) { var credentialDisplayData = storedCredentials .where((element) => cred.contains(element.value.rawCredential)) .map((e) => CredentialData( @@ -65,12 +65,12 @@ void handleOpenIDVpFlow(BuildContext context, String qrCodeURL) async { } } } - navigateToPresentMultiCred(context, credentialDisplayDataList, "Choose ${submission.count} credentials to present"); + navigateToPresentMultiCred(context, credentialDisplayDataList, 'Choose ${submission.count} credentials to present'); return; } else if (submission.count == 1) { var matchedVCsID = submission.inputDescriptors.first.matchedVCsID; if (matchedVCsID.length > 1) { - log("matched length, more than matched vc ids are found ${matchedVCsID.length}"); + log('matched length, more than matched vc ids are found ${matchedVCsID.length}'); var credentialDisplayData = storedCredentials .where((element) => credentials.contains(element.value.rawCredential)) .map((e) => CredentialData( @@ -83,21 +83,21 @@ void handleOpenIDVpFlow(BuildContext context, String qrCodeURL) async { navigateToPresentMultiCredChooseOne(context, credentialDisplayData); return; } else { - log("single matched vc id flow"); - var credentialDisplayData; + log('single matched vc id flow'); + String credentialDisplayData; for (var inputDes in submission.inputDescriptors) { for (var matchVC in inputDes.matchedVCs) { var credID = (await walletSDKPlugin.getCredID([matchVC]))!; var issuerURI = storedCredentials - .where((element) => credID!.contains(element.value.credID)) + .where((element) => credID.contains(element.value.credID)) .map((e) => e.value.issuerURL) .toList(); var credentialDID = - storedCredentials.firstWhere((element) => credID!.contains(element.value.credID)).value.credentialDID; + storedCredentials.firstWhere((element) => credID.contains(element.value.credID)).value.credentialDID; - log("matched issuerURI found: ${issuerURI}"); - credentialDisplayData = await walletSDKPlugin.serializeDisplayData([matchVC], issuerURI.first); - log("credentialDisplayData -> $credentialDisplayData"); + log('matched issuerURI found: $issuerURI'); + credentialDisplayData = (await walletSDKPlugin.serializeDisplayData([matchVC], issuerURI.first))!; + log('credentialDisplayData -> $credentialDisplayData'); navigateToPresentationPreviewScreen( context, CredentialData( diff --git a/demo/app/lib/services/config_service.dart b/demo/app/lib/services/config_service.dart index ae69f476..4ba6266d 100644 --- a/demo/app/lib/services/config_service.dart +++ b/demo/app/lib/services/config_service.dart @@ -18,7 +18,7 @@ class ConfigService{ connectIssuerConfigList.add(connectIssuerConfig); }); - log("decodedResponse $configResponseDecoded"); + log('decodedResponse $configResponseDecoded'); return connectIssuerConfigList; } } \ No newline at end of file diff --git a/demo/app/lib/services/storage_service.dart b/demo/app/lib/services/storage_service.dart index bb9e020c..94e91965 100644 --- a/demo/app/lib/services/storage_service.dart +++ b/demo/app/lib/services/storage_service.dart @@ -3,7 +3,6 @@ import 'dart:core'; import 'package:app/models/activity_data_object.dart'; import 'package:app/models/credential_data_object.dart'; -import 'package:app/models/activity_logger.dart'; import 'package:app/models/credential_data.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; @@ -18,13 +17,13 @@ class StorageService { Future addCredential(CredentialDataObject newItem) async { - debugPrint("Adding new data having key ${newItem.key}"); + debugPrint('Adding new data having key ${newItem.key}'); await _secureStorage.write( key: newItem.key, value: json.encode(newItem.value.toJson()), aOptions: _getAndroidOptions()); } Future> retrieveCredentials(String username) async { - debugPrint("Retrieve all secured data"); + debugPrint('Retrieve all secured data'); var allData = await _secureStorage.readAll(aOptions: _getAndroidOptions()); List list = allData.entries .where((e) => e.key.contains(username)) @@ -34,13 +33,13 @@ class StorageService { } Future addActivities(ActivityDataObj activityObj) async { - debugPrint("Adding new data having key ${activityObj.key}"); + debugPrint('Adding new data having key ${activityObj.key}'); await _secureStorage.write( key: activityObj.key, value: jsonEncode(activityObj.value), aOptions: _getAndroidOptions()); } Future retrieveActivities(String credID) async { - debugPrint("Retrieve stored activities $credID"); + debugPrint('Retrieve stored activities $credID'); var allData = await _secureStorage.readAll(aOptions: _getAndroidOptions()); List list = allData.entries .where((e) => e.key.contains(credID)) @@ -50,24 +49,24 @@ class StorageService { } Future deleteData(CredentialDataObject item) async { - debugPrint("Deleting data having key ${item.key}"); + debugPrint('Deleting data having key ${item.key}'); await _secureStorage.delete(key: item.key, aOptions: _getAndroidOptions()); } Future> retrieveAll() async { - debugPrint("Retrieve all secured data"); + debugPrint('Retrieve all secured data'); var allData = await _secureStorage.readAll(aOptions: _getAndroidOptions()); List list = allData.entries.map((e) => StorageItem(e.key, e.value)).toList(); return list; } Future deleteAllData() async { - debugPrint("Deleting all secured data"); + debugPrint('Deleting all secured data'); await _secureStorage.deleteAll(aOptions: _getAndroidOptions()); } Future containsKeyInSecureData(String key) async { - debugPrint("Checking data for the key $key"); + debugPrint('Checking data for the key $key'); var containsKey = await _secureStorage.containsKey(key: key, aOptions: _getAndroidOptions()); return containsKey; } diff --git a/demo/app/lib/views/credential_details.dart b/demo/app/lib/views/credential_details.dart index 4feac74c..35bd734f 100644 --- a/demo/app/lib/views/credential_details.dart +++ b/demo/app/lib/views/credential_details.dart @@ -65,13 +65,13 @@ class CredentialDetailsState extends State { } getCredentialDID(){ - return SelectableText(widget.credentialData.credentialDID!); + return SelectableText(widget.credentialData.credentialDID); } getDidDocument() async { final Future prefs = SharedPreferences.getInstance(); final SharedPreferences pref = await prefs; - var userDIDDoc = pref.getString("userDIDDoc"); + var userDIDDoc = pref.getString('userDIDDoc'); final parsedJson = json.decode(userDIDDoc!); didDoc = const JsonEncoder.withIndent(' ').convert(parsedJson); } @@ -105,7 +105,7 @@ class CredentialDetailsState extends State { child: SizedBox( width: 50, child: Text( - "Details", + 'Details', textAlign: TextAlign.start, ), ), @@ -116,7 +116,7 @@ class CredentialDetailsState extends State { child: SizedBox( width: 150, child: Text( - "Raw", + 'Raw', textAlign: TextAlign.start, ), ), @@ -126,18 +126,18 @@ class CredentialDetailsState extends State { child: SizedBox( width: 60, child: Text( - "Activity", + 'Activity', textAlign: TextAlign.start, textScaleFactor:1.0, ), ), ), Visibility( - visible: isSwitched!=null?isSwitched!:false, + visible: isSwitched ?? false, child: const Tab( child: SizedBox( width: 50, child: Text( - "DID", + 'DID', textAlign: TextAlign.start, ), ), @@ -194,16 +194,16 @@ class CredentialDetailsState extends State { title: Text( resp.date, textAlign: TextAlign.start, - style: TextStyle(fontSize: 14.0), + style: const TextStyle(fontSize: 14.0), ), subtitle: resp.operation == 'oidc-issuance' ? Text( - "Issued by: ${resp.issuedBy}", + 'Issued by: ${resp.issuedBy}', textAlign: TextAlign.start, - style: TextStyle(fontSize: 13.0, color: Colors.blue), + style: const TextStyle(fontSize: 13.0, color: Colors.blue), ) : Text( - "Presented to: ${resp.issuedBy!}", + 'Presented to: ${resp.issuedBy}', textAlign: TextAlign.start, - style: TextStyle(fontSize: 13.0, color: Colors.purple), + style: const TextStyle(fontSize: 13.0, color: Colors.purple), ), leading: resp.status == 'success' ? IconButton( icon: const Icon(Icons.check_circle, size: 32, color: Color(0xff66BB6A)), @@ -236,7 +236,7 @@ class CredentialDetailsState extends State { const Padding( padding:EdgeInsets.all(8.0), child: Text( - "DID", + 'DID', style: TextStyle( fontSize: 16, color: Color(0xff190C21), @@ -250,7 +250,7 @@ class CredentialDetailsState extends State { const Padding( padding:EdgeInsets.all(8.0), child: Text( - "DidDocument", + 'DidDocument', style: TextStyle( fontSize: 16, color: Color(0xff190C21), diff --git a/demo/app/lib/views/credential_list.dart b/demo/app/lib/views/credential_list.dart index 3f523cfa..8b9eb724 100644 --- a/demo/app/lib/views/credential_list.dart +++ b/demo/app/lib/views/credential_list.dart @@ -32,8 +32,8 @@ class _CredentialListState extends State { void initList() async { SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences p = prefs; - username = p.getString("userLoggedIn"); - log("list - $username"); + username = p.getString('userLoggedIn'); + log('list - $username'); _credentialList = await _storageService.retrieveCredentials(username!); if (_credentialList.isEmpty) { _loading = true; @@ -63,7 +63,7 @@ class _CredentialListState extends State { child: _loading ? const CircularProgressIndicator() : _credentialList.isEmpty - ? const Text("No credentials found") + ? const Text('No credentials found') : ListView.builder( itemCount: _credentialList.length, padding: const EdgeInsets.symmetric(horizontal: 8), diff --git a/demo/app/lib/views/credential_preview.dart b/demo/app/lib/views/credential_preview.dart index a0969b84..3ddc1531 100644 --- a/demo/app/lib/views/credential_preview.dart +++ b/demo/app/lib/views/credential_preview.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; -import 'dart:developer'; import 'package:app/main.dart'; import 'package:app/models/credential_data.dart'; import 'package:app/views/credential_added.dart'; @@ -25,7 +23,7 @@ class CredentialPreviewState extends State { final StorageService _storageService = StorageService(); var uuid = const Uuid(); late final String userLoggedIn; - String issuerDisplayData = ""; + String issuerDisplayData = ''; bool verifiedDomain = true; late String serviceURL = ''; String? issuerID; @@ -117,7 +115,7 @@ class CredentialPreviewState extends State { child: Text( textAlign: TextAlign.center, style: TextStyle(fontSize: 18, color: Colors.black), - "wants to issue the credential"), + 'wants to issue the credential'), ), CredentialCard(credentialData: widget.credentialData, isDashboardWidget: false, isDetailArrowRequired: false), Expanded( @@ -142,7 +140,7 @@ class CredentialPreviewState extends State { ), PrimaryButton( onPressed: () async { - _storageService.addCredential(CredentialDataObject("$userLoggedIn-${uuid.v1()}", widget.credentialData)); + _storageService.addCredential(CredentialDataObject('$userLoggedIn-${uuid.v1()}', widget.credentialData)); _navigateToCredentialAdded(); }, width: double.infinity, diff --git a/demo/app/lib/views/credential_shared.dart b/demo/app/lib/views/credential_shared.dart index 8bf292a1..b5bb55dc 100644 --- a/demo/app/lib/views/credential_shared.dart +++ b/demo/app/lib/views/credential_shared.dart @@ -6,7 +6,7 @@ import 'package:app/views/dashboard.dart'; class CredentialShared extends StatefulWidget { final String? verifierName; final List credentialData; - CredentialShared({super.key, this.verifierName, required this.credentialData,}); + const CredentialShared({super.key, this.verifierName, required this.credentialData,}); @override State createState() => CredentialSharedState (); @@ -57,7 +57,7 @@ class CredentialSharedState extends State { ], ), title: const Text('Success',textAlign: TextAlign.left, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), - subtitle: Text("Credentials have been shared with ${widget.verifierName}", style: const TextStyle(fontSize: 14, fontWeight: FontWeight.normal)), + subtitle: Text('Credentials have been shared with ${widget.verifierName}', style: const TextStyle(fontSize: 14, fontWeight: FontWeight.normal)), ), Expanded( child: ListView.builder( diff --git a/demo/app/lib/views/handle_redirect_uri.dart b/demo/app/lib/views/handle_redirect_uri.dart index 47ec37ab..38b8ca18 100644 --- a/demo/app/lib/views/handle_redirect_uri.dart +++ b/demo/app/lib/views/handle_redirect_uri.dart @@ -8,7 +8,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'dart:developer'; -import 'dart:convert'; import 'package:app/wallet_sdk/wallet_sdk_mobile.dart'; import 'package:app/services/storage_service.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -55,9 +54,9 @@ class HandleRedirectUriState extends State { Future _createDid() async { final SharedPreferences pref = await prefs; var didType = pref.getString('didType'); - didType = didType ?? "ion"; + didType = didType ?? 'ion'; var keyType = pref.getString('keyType'); - keyType = keyType ?? "ED25519"; + keyType = keyType ?? 'ED25519'; var didResolution = await WalletSDKPlugin.createDID(didType, keyType); var didID = didResolution.did; setState(() { @@ -74,29 +73,29 @@ class HandleRedirectUriState extends State { pref.setString('userDIDDoc', userDIDDoc); if (_redirectUri != null) { try { - if (widget.flowType == "issuer-initiated-flow") { - log("_redirectUri.toString() ${_redirectUri.toString()}"); + if (widget.flowType == 'issuer-initiated-flow') { + log('_redirectUri.toString() ${_redirectUri.toString()}'); var credentials = await WalletSDKPlugin.requestCredentialWithAuth(_redirectUri.toString()); var issuerURI = await WalletSDKPlugin.issuerURI(); var serializedDisplayData = await WalletSDKPlugin.serializeDisplayData([credentials], issuerURI!); - log("serializedDisplayData -> $serializedDisplayData"); + log('serializedDisplayData -> $serializedDisplayData'); var activities = await WalletSDKPlugin.storeActivityLogger(); var credID = await WalletSDKPlugin.getCredID([credentials]); await _storageService.addActivities(ActivityDataObj(credID!, activities)); - pref.setString("credID", credID); + pref.setString('credID', credID); _navigateToCredPreviewScreen(credentials, issuerURI, serializedDisplayData!, userDIDId, credID); } else { - log("_redirectUri.toString() ${_redirectUri.toString()}"); + log('_redirectUri.toString() ${_redirectUri.toString()}'); var credentials = await WalletSDKPlugin.requestCredentialWithWalletInitiatedFlow(_redirectUri.toString()); var issuerURI = widget.issuerURI; var serializedDisplayData = await WalletSDKPlugin.serializeDisplayData([credentials], issuerURI!); - log("serializedDisplayData -> $serializedDisplayData"); + log('serializedDisplayData -> $serializedDisplayData'); // TODO: Issue-518 Add activity logger support for wallet-initiated-flow - _navigateToCredPreviewScreen(credentials, issuerURI, serializedDisplayData!, userDIDId, ""); + _navigateToCredPreviewScreen(credentials, issuerURI, serializedDisplayData!, userDIDId, ''); } } catch (error) { - log("error -> ${error.toString()}"); - if (error.toString().contains("UKN2-000") || error.toString().contains("OCI1-0008")) { + log('error -> ${error.toString()}'); + if (error.toString().contains('UKN2-000') || error.toString().contains('OCI1-0008')) { SizedBox( height: MediaQuery.of(context).size.height / 1.9, child: const Center( @@ -108,8 +107,8 @@ class HandleRedirectUriState extends State { context, MaterialPageRoute( builder: (context) => CustomError( - titleBar: "Redirect URI", - requestErrorTitleMsg: "Redirect uri error", requestErrorSubTitleMsg: error.toString()))); + titleBar: 'Redirect URI', + requestErrorTitleMsg: 'Redirect uri error', requestErrorSubTitleMsg: error.toString()))); } } } @@ -140,9 +139,9 @@ class HandleRedirectUriState extends State { _handleIncomingLinks() async { if (!kIsWeb) { - _sub = await uriLinkStream.listen((Uri? uri) { + _sub = uriLinkStream.listen((Uri? uri) { if (!mounted) return; - log("received redirect uri $uri"); + log('received redirect uri $uri'); setState(() { _redirectUri = uri; _err = null; diff --git a/demo/app/lib/views/issuance_preview.dart b/demo/app/lib/views/issuance_preview.dart index 30c2b755..20964b2b 100644 --- a/demo/app/lib/views/issuance_preview.dart +++ b/demo/app/lib/views/issuance_preview.dart @@ -4,7 +4,6 @@ Copyright Gen Digital Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -import 'dart:convert'; import 'dart:developer'; import 'package:app/main.dart'; @@ -34,9 +33,9 @@ class IssuancePreview extends StatefulWidget { } class IssuancePreviewState extends State { - String issuerDisplayName = ""; - String credentialIssuer = ""; - String credentialDisplayName = ""; + String issuerDisplayName = ''; + String credentialIssuer = ''; + String credentialDisplayName = ''; String backgroundColor = ''; String issuerDisplayURL = ''; String textColor = ''; @@ -86,7 +85,7 @@ class IssuancePreviewState extends State { child: Text( textAlign: TextAlign.center, style: TextStyle(fontSize: 18, color: Colors.black), - "Add this credential ?"), + 'Add this credential ?'), ), const SizedBox(height: 30), CachedNetworkImage( @@ -216,7 +215,7 @@ class IssuancePreviewState extends State { void navigateToAuthFlow(BuildContext context, Uri uri) async { Navigator.of(context) - .push(MaterialPageRoute(builder: (context) => HandleRedirectUri(uri, "issuer-initiated-flow", ""))); + .push(MaterialPageRoute(builder: (context) => HandleRedirectUri(uri, 'issuer-initiated-flow', ''))); } void navigateToWithoutPinFlow(BuildContext context) async { @@ -234,13 +233,13 @@ class IssuancePreviewState extends State { var didType = pref.getString('didType'); var keyType = pref.getString('keyType'); // choosing default if no selection is made - didType = didType ?? "ion"; - keyType = keyType ?? "ED25519"; + didType = didType ?? 'ion'; + keyType = keyType ?? 'ED25519'; var didResolution = await WalletSDKPlugin.createDID(didType, keyType); var didID = didResolution.did; var didDoc = didResolution.didDoc; - log("created didID :$didID"); + log('created didID :$didID'); pref.setString('userDID', didID); pref.setString('userDIDDoc', didDoc); @@ -253,7 +252,7 @@ class IssuancePreviewState extends State { var credID = await WalletSDKPlugin.getCredID([credentials]); - log("activities and credID handle open id -$activities and $credID"); + log('activities and credID handle open id -$activities and $credID'); storageService.addActivities(ActivityDataObj(credID!, activities)); return CredentialData( diff --git a/demo/app/lib/views/otp.dart b/demo/app/lib/views/otp.dart index 18f7007b..5f10c948 100644 --- a/demo/app/lib/views/otp.dart +++ b/demo/app/lib/views/otp.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'dart:developer'; import 'package:app/models/activity_data_object.dart'; @@ -33,9 +32,9 @@ class _OTPPage extends State { Future _createDid() async { final SharedPreferences pref = await prefs; var didType = pref.getString('didType'); - didType = didType ?? "ion"; + didType = didType ?? 'ion'; var keyType = pref.getString('keyType'); - keyType = keyType ?? "ED25519"; + keyType = keyType ?? 'ED25519'; var didResolution = await WalletSDKPlugin.createDID(didType, keyType); var didID = didResolution.did; setState(() { @@ -186,30 +185,30 @@ class _OTPPage extends State { String? issuerURI = await WalletSDKPlugin.issuerURI(); serializeDisplayData = await WalletSDKPlugin.serializeDisplayData([credentials], issuerURI!); - log("serializeDisplayData -> $serializeDisplayData"); + log('serializeDisplayData -> $serializeDisplayData'); var activities = await WalletSDKPlugin.storeActivityLogger(); var credID = await WalletSDKPlugin.getCredID([credentials]); - log("activities and credID -$activities and $credID"); + log('activities and credID -$activities and $credID'); _storageService.addActivities(ActivityDataObj(credID!, activities)); - pref.setString("credID", credID); + pref.setString('credID', credID); _navigateToCredPreviewScreen( credentials, issuerURI, serializeDisplayData!, userDIDId, credID); } catch (err) { String errorMessage = err.toString(); - log("errorMessage-> $errorMessage"); + log('errorMessage-> $errorMessage'); if (err is PlatformException && err.message != null && err.message!.isNotEmpty) { - log("err.details-> ${err.details}"); + log('err.details-> ${err.details}'); var resp = await WalletSDKPlugin.parseWalletSDKError(localizedErrorMessage: err.details); - log("resp-> $resp"); - (resp.category == "INVALID_GRANT") + log('resp-> $resp'); + (resp.category == 'INVALID_GRANT') ? { - errorMessage = "Try re-entering the PIN or scan a new QR code", + errorMessage = 'Try re-entering the PIN or scan a new QR code', _requestErrorDetailMsg = resp.details } - : (resp.category == "INVALID_TOKEN") + : (resp.category == 'INVALID_TOKEN') ? { - errorMessage = "Try scanning a new QR code", + errorMessage = 'Try scanning a new QR code', _requestErrorDetailMsg = resp.details } : {errorMessage = resp.details, _requestErrorDetailMsg = resp.traceID}; diff --git a/demo/app/lib/views/presentation_preview.dart b/demo/app/lib/views/presentation_preview.dart index d634576b..fdf268a1 100644 --- a/demo/app/lib/views/presentation_preview.dart +++ b/demo/app/lib/views/presentation_preview.dart @@ -42,7 +42,7 @@ class PresentationPreviewState extends State { super.initState(); WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { final verifiedDisplayData = await WalletSDKPlugin.getVerifierDisplayData(); - log("verifiedDisplayData ${verifiedDisplayData.logoURI}"); + log('verifiedDisplayData ${verifiedDisplayData.logoURI}'); var resp = await WalletSDKPlugin.wellKnownDidConfig(verifiedDisplayData.did); setState(() { verifierName = verifiedDisplayData.name; @@ -72,7 +72,7 @@ class PresentationPreviewState extends State { leading: verifierLogoURL == '' ? const SizedBox.shrink() : CachedNetworkImage( - imageUrl: verifierLogoURL!, + imageUrl: verifierLogoURL, placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => Image.asset('lib/assets/images/credLogo.png', fit: BoxFit.contain), @@ -81,11 +81,11 @@ class PresentationPreviewState extends State { fit: BoxFit.contain, ), title: Text(verifierName, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), - subtitle: Text(serviceURL != "" ? serviceURL : 'verifier.com', + subtitle: Text(serviceURL != '' ? serviceURL : 'verifier.com', style: const TextStyle(fontSize: 12, fontWeight: FontWeight.normal)), trailing: FittedBox( child: verifiedDomain - ? Row(children: [ + ? const Row(children: [ Text.rich( textAlign: TextAlign.center, TextSpan( @@ -108,7 +108,7 @@ class PresentationPreviewState extends State { ), ), ]) - : Row( + : const Row( children: [ Text.rich( textAlign: TextAlign.center, @@ -163,15 +163,15 @@ class PresentationPreviewState extends State { context, MaterialPageRoute( builder: (context) => CustomError( - titleBar: "Presentation Preview", - requestErrorTitleMsg: "error while presenting credential", - requestErrorSubTitleMsg: "${errString}"))); + titleBar: 'Presentation Preview', + requestErrorTitleMsg: 'error while presenting credential', + requestErrorSubTitleMsg: errString))); return; } var activities = await WalletSDKPlugin.storeActivityLogger(); var credID = pref.getString('credID'); _storageService.addActivities(ActivityDataObj(credID!, activities)); - _navigateToCredentialShareSuccess(verifierName!); + _navigateToCredentialShareSuccess(verifierName); }, width: double.infinity, child: const Text('Share Credential', style: TextStyle(fontSize: 16, color: Colors.white))), diff --git a/demo/app/lib/views/presentation_preview_multi_cred.dart b/demo/app/lib/views/presentation_preview_multi_cred.dart index 0d2bc4af..90a0db2e 100644 --- a/demo/app/lib/views/presentation_preview_multi_cred.dart +++ b/demo/app/lib/views/presentation_preview_multi_cred.dart @@ -45,7 +45,7 @@ class PresentationPreviewMultiCredCheckState extends State const CircularProgressIndicator(), errorWidget: (context, url, error) => Image.asset('lib/assets/images/credLogo.png', fit: BoxFit.contain), @@ -87,11 +87,11 @@ class PresentationPreviewMultiCredCheckState extends State rememberMe = value!); } else { selectedIndexes.add(index); multipleSelected.add(checkListItems[index].rawCredential); - log("multiple selected adding ${multipleSelected}"); + log('multiple selected adding $multipleSelected'); selectedCredentialData.add(CredentialData( rawCredential: checkListItems[index].rawCredential, credentialDisplayData: checkListItems[index].credentialDisplayData, @@ -200,7 +200,7 @@ class PresentationPreviewMultiCredCheckState extends State showErrorMessage = true); - else + } else { setState(() => showErrorMessage = false); + } final SharedPreferences pref = await prefs; try { await WalletSDKPlugin.presentCredential( selectedCredentials: multipleSelected.cast()); } catch (error) { log(error.toString()); - if (!error.toString().contains("OVP1-0002")) { + if (!error.toString().contains('OVP1-0002')) { var errString = error.toString().replaceAll(r'\', ''); Navigator.push( context, MaterialPageRoute( builder: (context) => CustomError( - titleBar: "Multi Presentation Preview", - requestErrorTitleMsg: "error while presenting credential", - requestErrorSubTitleMsg: "${errString}"))); + titleBar: 'Multi Presentation Preview', + requestErrorTitleMsg: 'error while presenting credential', + requestErrorSubTitleMsg: errString))); return; } else { await WalletSDKPlugin.presentCredential( diff --git a/demo/app/lib/views/presentation_preview_multi_cred_radio.dart b/demo/app/lib/views/presentation_preview_multi_cred_radio.dart index 3848f421..4ecc1822 100644 --- a/demo/app/lib/views/presentation_preview_multi_cred_radio.dart +++ b/demo/app/lib/views/presentation_preview_multi_cred_radio.dart @@ -37,7 +37,7 @@ class PresentationPreviewMultiCredState extends State const CircularProgressIndicator(), errorWidget: (context, url, error) => Image.asset('lib/assets/images/credLogo.png', fit: BoxFit.contain), @@ -84,11 +84,11 @@ class PresentationPreviewMultiCredState extends State { SwitchListTile( value: isSwitched, contentPadding: EdgeInsets.zero, - title: const Text("Dev Mode", style: TextStyle(color: Color(0xff190C21), + title: const Text('Dev Mode', style: TextStyle(color: Color(0xff190C21), fontWeight: FontWeight.w700, fontFamily: 'SF Pro', fontSize: 14, @@ -120,8 +120,8 @@ class SettingsState extends State { ), DropdownButtonFormField( value: selectedDIDType, - decoration: InputDecoration( - labelText: "Select DID Method", + decoration: const InputDecoration( + labelText: 'Select DID Method', filled: false, ), icon: const Icon(Icons.arrow_drop_down), @@ -143,8 +143,8 @@ class SettingsState extends State { ), DropdownButtonFormField( value: selectedKeyType, - decoration: InputDecoration( - labelText: "Select Key Type", + decoration: const InputDecoration( + labelText: 'Select Key Type', filled: false, ), icon: const Icon(Icons.arrow_drop_down), @@ -232,14 +232,14 @@ class SettingsState extends State { var versionDetailResp = await walletSDKPlugin.getVersionDetails(); var didDocEncoded = json.encode(versionDetailResp!); Map responseJson = json.decode(didDocEncoded); - walletSDKVersion = responseJson["walletSDKVersion"]; - gitRevision = responseJson["gitRevision"]; - buildTimeRev = responseJson["buildTimeRev"]; + walletSDKVersion = responseJson['walletSDKVersion']; + gitRevision = responseJson['gitRevision']; + buildTimeRev = responseJson['buildTimeRev']; } getUserDetails() async { UserLoginDetails userLoginDetails = await getUser(); - log("userLoginDetails -> $userLoginDetails"); + log('userLoginDetails -> $userLoginDetails'); usernameController.text = userLoginDetails.username!; } diff --git a/demo/app/lib/views/supported_credentials_list.dart b/demo/app/lib/views/supported_credentials_list.dart index 4bf7620c..d3b528cd 100644 --- a/demo/app/lib/views/supported_credentials_list.dart +++ b/demo/app/lib/views/supported_credentials_list.dart @@ -51,7 +51,7 @@ class SupportedCredentialsListState extends State { children: [ const SizedBox(height: 20), const Text( - "Please select a credential type from below ", + 'Please select a credential type from below ', style: TextStyle(fontSize: 14, color: Color(0xff190C21), fontFamily: 'SF Pro', fontWeight: FontWeight.bold), ), @@ -116,7 +116,7 @@ class SupportedCredentialsListState extends State { navigateToAuthFlow(context, uri, widget.issuerURI); }, child: const Text( - "Request", + 'Request', style: TextStyle(fontSize: 12, color: Color(0xff190C21)), ), ), @@ -132,6 +132,6 @@ class SupportedCredentialsListState extends State { void navigateToAuthFlow(BuildContext context, Uri uri, String? issuerURI) async { Navigator.of(context) - .push(MaterialPageRoute(builder: (context) => HandleRedirectUri(uri, "wallet-initiated-flow", issuerURI))); + .push(MaterialPageRoute(builder: (context) => HandleRedirectUri(uri, 'wallet-initiated-flow', issuerURI))); } } diff --git a/demo/app/lib/views/wallet_initiated_connect.dart b/demo/app/lib/views/wallet_initiated_connect.dart index 383cd684..4b2f69cb 100644 --- a/demo/app/lib/views/wallet_initiated_connect.dart +++ b/demo/app/lib/views/wallet_initiated_connect.dart @@ -109,15 +109,15 @@ class ConnectIssuerListState extends State { var supportedCredentials = await connect(connectIssuerConfigList.elementAt(index).value.issuerURI); var connectIssuerConfigValue = ConnectIssuerConfigValue( - issuerURI: "", + issuerURI: '', scopes: connectIssuerConfigList.elementAt(index).value.scopes, clientID: connectIssuerConfigList.elementAt(index).value.clientID, redirectURI: connectIssuerConfigList.elementAt(index).value.redirectURI, showIssuer: true, - description: "", - backgroundColor: "", - textColor: "", - logo: ""); + description: '', + backgroundColor: '', + textColor: '', + logo: ''); _navigateToSupportedCredentialScreen( connectIssuerConfigList.elementAt(index).key, connectIssuerConfigList.elementAt(index).value.issuerURI, diff --git a/demo/app/lib/wallet_sdk/wallet_sdk_js.dart b/demo/app/lib/wallet_sdk/wallet_sdk_js.dart index 5c5edcbf..82f12592 100644 --- a/demo/app/lib/wallet_sdk/wallet_sdk_js.dart +++ b/demo/app/lib/wallet_sdk/wallet_sdk_js.dart @@ -260,7 +260,7 @@ class WalletSDK extends WalletPlatform { final result = await promiseToFuture(jsCreateOpenID4CIInteraction(initiateIssuanceURI)) as CreateOpenID4CIInteractionResult; - return {"pinRequired": result.userPINRequired}; + return {'pinRequired': result.userPINRequired}; } on PlatformException catch (error) { debugPrint(error.toString()); rethrow; @@ -297,7 +297,7 @@ class WalletSDK extends WalletPlatform { await promiseToFuture(jsVerifyCredentialsStatus(credential)); return true; } catch (error) { - if (error.toString().contains("status verification failed: revoked")) { + if (error.toString().contains('status verification failed: revoked')) { return false; } else { debugPrint(error.toString()); @@ -378,7 +378,7 @@ class WalletSDK extends WalletPlatform { Future?> getVersionDetails() async { var versionDetailResp = await methodChannel.invokeMethod('getVersionDetails'); - log("getVersionDetails in the app, $versionDetailResp"); + log('getVersionDetails in the app, $versionDetailResp'); return versionDetailResp; } @@ -426,7 +426,7 @@ class WalletSDK extends WalletPlatform { localizedIssuerDisplays: localizedIssuerDisplays, )]; - debugPrint("Issuer Metadata: $issuerMetadata"); + debugPrint('Issuer Metadata: $issuerMetadata'); return issuerMetadata; } @@ -452,7 +452,7 @@ class WalletSDK extends WalletPlatform { try { final issuerID = await methodChannel.invokeMethod('getIssuerID', {'vcCredentials': credentials}); - log("get issuerID - , $issuerID"); + log('get issuerID - , $issuerID'); return issuerID; } on PlatformException catch (error) { if (error.code == errorCode) { diff --git a/demo/app/lib/wallet_sdk/wallet_sdk_mobile.dart b/demo/app/lib/wallet_sdk/wallet_sdk_mobile.dart index cb52d4f0..0e27c8bc 100644 --- a/demo/app/lib/wallet_sdk/wallet_sdk_mobile.dart +++ b/demo/app/lib/wallet_sdk/wallet_sdk_mobile.dart @@ -67,7 +67,7 @@ class WalletSDK extends WalletPlatform { 'redirectURI': redirectURI, 'issuerURI': issuerURI }); - log("authorizationURL Wallet-Initiated-Flow -> $authorizationURL"); + log('authorizationURL Wallet-Initiated-Flow -> $authorizationURL'); return authorizationURL; } on PlatformException catch (error) { debugPrint(error.toString()); @@ -122,7 +122,7 @@ class WalletSDK extends WalletPlatform { }); return credentialStatusVerifier!; } on PlatformException catch (error) { - if (error.toString().contains("status verification failed: revoked")) { + if (error.toString().contains('status verification failed: revoked')) { return false; } else { debugPrint(error.toString()); @@ -165,7 +165,7 @@ class WalletSDK extends WalletPlatform { Future?> getVersionDetails() async { var versionDetailResp = await methodChannel.invokeMethod('getVersionDetails'); - log("getVersionDetails in the app, $versionDetailResp"); + log('getVersionDetails in the app, $versionDetailResp'); return versionDetailResp; } diff --git a/demo/app/lib/wallet_sdk/wallet_sdk_model.dart b/demo/app/lib/wallet_sdk/wallet_sdk_model.dart index d475419f..b82b36b1 100644 --- a/demo/app/lib/wallet_sdk/wallet_sdk_model.dart +++ b/demo/app/lib/wallet_sdk/wallet_sdk_model.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; class WellKnownDidConfig { final bool isValid; @@ -355,13 +354,7 @@ class CredentialDisplayData { @override String toString() { - return 'CredentialDisplayData{' + - ' issuerName: $issuerName,' + - ' overviewName: $overviewName,' + - ' logo: $logo,' + - ' backgroundColor: $backgroundColor,' + - ' textColor: $textColor,' + - '}'; + return 'CredentialDisplayData{ issuerName: $issuerName, overviewName: $overviewName, logo: $logo, backgroundColor: $backgroundColor, textColor: $textColor,}'; } CredentialDisplayData copyWith({ @@ -440,13 +433,7 @@ class CredentialDisplayClaim { @override String toString() { - return 'CredentialDisplayClaim{' + - ' rawValue: $rawValue,' + - ' valueType: $valueType,' + - ' label: $label,' + - ' value: $value,' + - ' order: $order,' + - '}'; + return 'CredentialDisplayClaim{ rawValue: $rawValue, valueType: $valueType, label: $label, value: $value, order: $order,}'; } CredentialDisplayClaim copyWith({ @@ -517,12 +504,7 @@ class VerifierDisplayData { @override String toString() { - return 'VerifierDisplayData{' + - ' name: $name,' + - ' did: $did,' + - ' purpose: $purpose,' + - ' logoURI: $logoURI,' + - '}'; + return 'VerifierDisplayData{ name: $name, did: $did, purpose: $purpose, logoURI: $logoURI,}'; } VerifierDisplayData copyWith({ diff --git a/demo/app/lib/widgets/credential_metadata_card.dart b/demo/app/lib/widgets/credential_metadata_card.dart index c636b0fb..a6eca6b2 100644 --- a/demo/app/lib/widgets/credential_metadata_card.dart +++ b/demo/app/lib/widgets/credential_metadata_card.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'dart:developer'; import 'package:app/wallet_sdk/wallet_sdk_model.dart'; @@ -39,7 +38,7 @@ class CredentialMetaDataCard extends StatefulWidget { (response) => { setState(() { - log("status $response"); + log('status $response'); verifiedStatus = response; } )}); @@ -47,7 +46,7 @@ class CredentialMetaDataCard extends StatefulWidget { getIssuanceDate() { var claimsList = credentialClaimsData; for (var claims in claimsList) { - if (claims.label.contains("Issue Date")) { + if (claims.label.contains('Issue Date')) { var issueDate = claims.rawValue; return issueDate; } @@ -60,7 +59,7 @@ class CredentialMetaDataCard extends StatefulWidget { getExpiryDate() { var claimsList = credentialClaimsData; for (var claims in claimsList) { - if (claims.label.contains("Expiry Date")) { + if (claims.label.contains('Expiry Date')) { var expiryDate = claims.rawValue; return expiryDate; } diff --git a/demo/app/lib/widgets/credential_verified_information_view.dart b/demo/app/lib/widgets/credential_verified_information_view.dart index a8f87e4b..0d7f4386 100644 --- a/demo/app/lib/widgets/credential_verified_information_view.dart +++ b/demo/app/lib/widgets/credential_verified_information_view.dart @@ -51,7 +51,7 @@ class CredentialVerifiedInformation extends StatefulWidget { controller: credDataController, shrinkWrap: true, itemBuilder: (context, position) { - if (credPrev[position].valueType != "image"){ + if (credPrev[position].valueType != 'image'){ return Row( children: [ const Divider( @@ -96,7 +96,7 @@ class CredentialVerifiedInformation extends StatefulWidget { }, ) ], - ) : Column() + ) : const Column() ), ), ], @@ -145,10 +145,10 @@ class CredentialVerifiedInformation extends StatefulWidget { child: SingleChildScrollView( child: Column( children: [ - Row( + const Row( crossAxisAlignment: CrossAxisAlignment.start, - children: const [ - Text( "Verified information", style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700)) + children: [ + Text( 'Verified information', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700)) ] ), const SizedBox(height: 10), diff --git a/demo/app/lib/widgets/success_card.dart b/demo/app/lib/widgets/success_card.dart index d98cfdec..57030eb5 100644 --- a/demo/app/lib/widgets/success_card.dart +++ b/demo/app/lib/widgets/success_card.dart @@ -9,6 +9,7 @@ class SuccessCard extends StatelessWidget { SuccessCard({required this.credentialData, this.verifierName, this.subTitle, Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xffF4F1F5), diff --git a/demo/app/pubspec.lock b/demo/app/pubspec.lock index 5f07d9d1..8fbbfd52 100644 --- a/demo/app/pubspec.lock +++ b/demo/app/pubspec.lock @@ -167,10 +167,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" flutter_secure_storage: dependency: "direct main" description: diff --git a/demo/app/pubspec.yaml b/demo/app/pubspec.yaml index 0bf59880..51a1883b 100644 --- a/demo/app/pubspec.yaml +++ b/demo/app/pubspec.yaml @@ -58,7 +58,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^2.0.0 + flutter_lints: ^2.0.3 flutter_launcher_icons: "^0.9.0" flutter_launcher_name: