From 0c9dda6ac3898be74a8605d2ab5e4689b202729d Mon Sep 17 00:00:00 2001 From: Moe Jangda Date: Thu, 11 Jan 2024 10:57:38 -0600 Subject: [PATCH] address PR comments Co-Authored-By: Wes --- packages/web5/lib/src/dids/data_models/did_document.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/web5/lib/src/dids/data_models/did_document.dart b/packages/web5/lib/src/dids/data_models/did_document.dart index edc8414..5376f4d 100644 --- a/packages/web5/lib/src/dids/data_models/did_document.dart +++ b/packages/web5/lib/src/dids/data_models/did_document.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart'; import 'package:web5/src/dids/data_models/service.dart'; import 'package:web5/src/dids/data_models/did_resource.dart'; import 'package:web5/src/dids/data_models/verification_method.dart'; @@ -142,14 +143,14 @@ class DidDocument implements DidResource { } } - DidResource? resource = - verificationMethod?.firstWhere((vm) => idVariations.contains(vm.id)); + DidResource? resource = verificationMethod + ?.firstWhereOrNull((vm) => idVariations.contains(vm.id)); if (resource != null) { return resource; } - resource = service?.firstWhere((vm) => idVariations.contains(vm.id)); + resource = service?.firstWhereOrNull((vm) => idVariations.contains(vm.id)); return resource; }