Skip to content

Commit 8b70bd2

Browse files
committed
Fix dart warnings
1 parent 17fc0db commit 8b70bd2

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

lib/src/c14n_canonicalization.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class C14nCanonicalization implements CanonicalizationAlgorithm<String> {
165165
}
166166

167167
if (xmlData.contains(node.nodeType)) {
168-
return encodeSpecialCharactersInText(node.text);
168+
return encodeSpecialCharactersInText(node.value ?? '');
169169
}
170170

171171
if (node is XmlElement) {
@@ -222,7 +222,7 @@ class C14nCanonicalization implements CanonicalizationAlgorithm<String> {
222222
}
223223
}
224224

225-
return '${isAfterDocument ? '\n' : ''}<!--${encodeSpecialCharactersInText(node.text)}-->${isBeforeDocument ? '\n' : ''}';
225+
return '${isAfterDocument ? '\n' : ''}<!--${encodeSpecialCharactersInText(node.value ?? '')}-->${isBeforeDocument ? '\n' : ''}';
226226
}
227227

228228
@override

lib/src/enveloped_signature.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class EnvelopedSignature implements CanonicalizationAlgorithm<XmlNode> {
3232
assert(signatureNode is XmlElement);
3333
final expectedSignatureValue = findFirst(signatureNode as XmlElement,
3434
".//*[local-name()='SignatureValue']/text()")
35-
.text;
35+
.innerText;
3636
final signatures = XmlXPath.node(node).query(
3737
'.//*[local-name()="Signature"]'); // FIXME: namespace-uri() not supported
3838
// .query('.//*[local-name()="Signature" and namespace-uri()="http://www.w3.org/2000/09/xmldsig#"]');
@@ -41,7 +41,7 @@ class EnvelopedSignature implements CanonicalizationAlgorithm<XmlNode> {
4141
assert(child is XmlElement);
4242
final signatureValue = findFirst(
4343
child as XmlElement, ".//*[local-name()='SignatureValue']/text()")
44-
.text;
44+
.innerText;
4545
if (expectedSignatureValue == signatureValue) {
4646
child.parent?.children.remove(child);
4747
}

lib/src/exclusive_canonicalization.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ExclusiveCanonicalization extends C14nCanonicalization {
9999
}
100100

101101
if (xmlData.contains(node.nodeType)) {
102-
return encodeSpecialCharactersInText(node.text);
102+
return encodeSpecialCharactersInText(node.value ?? '');
103103
}
104104

105105
if (node is XmlElement) {

lib/src/signed_xml.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ class SignedXml {
413413

414414
signatureValue =
415415
findFirst(signatureNode, ".//*[local-name()='SignatureValue']/text()")
416-
.text
416+
.innerText
417417
.replaceAll(RegExp(r'\r?\n'), '');
418418
keyInfo = XmlXPath.node(signatureNode)
419419
.query(".//*[local-name()='KeyInfo']")
@@ -441,11 +441,11 @@ class SignedXml {
441441
throw ArgumentError('could not find DigestValue in reference $ref');
442442
}
443443
if (nodes.first.firstChild == null ||
444-
(nodes.first.firstChild?.text ?? '') == '') {
444+
(nodes.first.firstChild?.value ?? '') == '') {
445445
throw ArgumentError(
446446
'could not find the value of DigestValue in ${nodes.first}');
447447
}
448-
final digestValue = nodes.first.firstChild!.text;
448+
final digestValue = nodes.first.firstChild!.value;
449449

450450
final transforms = <String>[];
451451
String? inclusiveNamespacesPrefixList;

test/signature_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ void passLoadSignature(String file, [bool toString = false]) {
924924

925925
final doc2 = parseFromString(sig.keyInfo!);
926926
final keyInfo = XmlXPath.node(doc2).query("//*[local-name()='KeyInfo']/*[local-name()='dummyKey']").node!.node;
927-
expect(keyInfo.firstChild?.text, '1234', reason: 'keyInfo clause not correctly loaded');
927+
expect(keyInfo.firstChild?.value, '1234', reason: 'keyInfo clause not correctly loaded');
928928
expect(sig.references.length, 3);
929929

930930
final digests = ['b5GCZ2xpP5T7tbLWBTkOl4CYupQ=', 'K4dI497ZCxzweDIrbndUSmtoezY=', 'sH1gxKve8wlU8LlFVa2l6w3HMJ0='];

0 commit comments

Comments
 (0)