Skip to content

Commit 7fdbff1

Browse files
Copilot0xrinegade
andcommitted
Fix critical Flutter SDK build errors and linting issues
- Fixed constant expression type errors by removing const from string multiplication - Removed unused import package:flutter/services.dart from test files - Fixed dangling library doc comments by adding library directive - Replaced print statements with debugPrint for proper Flutter logging - Fixed unused catch clause in error handling - Updated constructors to use super parameters in TypeScript classes - Fixed unused local variable in bug fixes test - Improved const constructors and const declarations - All critical errors and warnings resolved, only minor info-level suggestions remain Co-authored-by: 0xrinegade <[email protected]>
1 parent b9c7fb1 commit 7fdbff1

File tree

7 files changed

+37
-38
lines changed

7 files changed

+37
-38
lines changed

flutter_sdk/example/pubspec.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,18 @@ packages:
126126
dependency: transitive
127127
description:
128128
name: leak_tracker
129-
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
129+
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
130130
url: "https://pub.dev"
131131
source: hosted
132-
version: "10.0.4"
132+
version: "10.0.5"
133133
leak_tracker_flutter_testing:
134134
dependency: transitive
135135
description:
136136
name: leak_tracker_flutter_testing
137-
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
137+
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
138138
url: "https://pub.dev"
139139
source: hosted
140-
version: "3.0.3"
140+
version: "3.0.5"
141141
leak_tracker_testing:
142142
dependency: transitive
143143
description:
@@ -166,18 +166,18 @@ packages:
166166
dependency: transitive
167167
description:
168168
name: material_color_utilities
169-
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
169+
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
170170
url: "https://pub.dev"
171171
source: hosted
172-
version: "0.8.0"
172+
version: "0.11.1"
173173
meta:
174174
dependency: transitive
175175
description:
176176
name: meta
177-
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
177+
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
178178
url: "https://pub.dev"
179179
source: hosted
180-
version: "1.12.0"
180+
version: "1.15.0"
181181
path:
182182
dependency: transitive
183183
description:
@@ -190,10 +190,10 @@ packages:
190190
dependency: transitive
191191
description:
192192
name: platform
193-
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
193+
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
194194
url: "https://pub.dev"
195195
source: hosted
196-
version: "3.1.4"
196+
version: "3.1.5"
197197
plugin_platform_interface:
198198
dependency: transitive
199199
description:
@@ -274,10 +274,10 @@ packages:
274274
dependency: transitive
275275
description:
276276
name: test_api
277-
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
277+
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
278278
url: "https://pub.dev"
279279
source: hosted
280-
version: "0.7.0"
280+
version: "0.7.2"
281281
typed_data:
282282
dependency: transitive
283283
description:
@@ -298,10 +298,10 @@ packages:
298298
dependency: transitive
299299
description:
300300
name: vm_service
301-
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
301+
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
302302
url: "https://pub.dev"
303303
source: hosted
304-
version: "14.2.1"
304+
version: "14.2.5"
305305
web:
306306
dependency: transitive
307307
description:

flutter_sdk/lib/src/network_adapters.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// Network Adapters for SVM-Pay Flutter SDK
22
///
33
/// This file implements network-specific adapters for different SVM networks.
4+
library;
45

56
import 'types.dart';
67

flutter_sdk/lib/src/payment_widgets.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// Payment Widgets for SVM-Pay Flutter SDK
22
///
33
/// This file implements Flutter widgets for easy payment integration.
4+
library;
45

56
import 'package:flutter/material.dart';
67
import 'package:flutter/services.dart';

flutter_sdk/lib/src/svm_pay_sdk.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/// SVM-Pay Flutter SDK
22
///
33
/// This file implements the main SDK class for SVM-Pay Flutter integration.
4+
library;
45

56
import 'dart:async';
67
import 'dart:convert';
78
import 'dart:math' show Random;
9+
import 'package:flutter/foundation.dart';
810
import 'package:flutter/services.dart';
911
import 'package:crypto/crypto.dart';
1012

@@ -215,7 +217,7 @@ class SVMPay {
215217
if (_config.debug) {
216218
// Fix Bug #10: More thorough error sanitization
217219
final sanitizedError = _sanitizeErrorMessage(e.toString());
218-
print('SVM-Pay: Error parsing URL: $sanitizedError');
220+
_log('Error parsing URL: $sanitizedError');
219221
}
220222
return null;
221223
}
@@ -265,7 +267,7 @@ class SVMPay {
265267
.replaceAll(RegExp(r'\b[1-9A-HJ-NP-Za-km-z]{32,44}\b'), '[ADDRESS_REDACTED]')
266268
.replaceAll(RegExp(r'"signature":\s*"[^"]*"'), '"signature": "[SIGNATURE_REDACTED]"')
267269
.replaceAll(RegExp(r'"transaction":\s*"[^"]*"'), '"transaction": "[TRANSACTION_REDACTED]"');
268-
print('SVM-Pay: $sanitized');
270+
debugPrint('SVM-Pay: $sanitized');
269271
}
270272
}
271273

@@ -409,7 +411,7 @@ class SVMPay {
409411
} on PlatformException catch (e) {
410412
_log('Platform error getting balance: ${e.code}');
411413
throw Exception('Failed to get wallet balance: ${_sanitizeErrorMessage(e.message ?? 'Unknown error')}');
412-
} on TimeoutException catch (e) {
414+
} on TimeoutException {
413415
_log('Timeout getting balance');
414416
throw Exception('Balance request timed out. Please try again.');
415417
} catch (e) {

flutter_sdk/lib/src/types.dart

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// SVM-Pay Flutter SDK Types
22
///
33
/// This file defines the core types used throughout the SVM-Pay Flutter SDK.
4+
library;
45

56
/// Supported SVM networks
67
enum SVMNetwork {
@@ -118,17 +119,14 @@ class TransferRequest extends PaymentRequest {
118119
const TransferRequest({
119120
required this.recipient,
120121
required this.amount,
121-
required SVMNetwork network,
122+
required super.network,
122123
this.splToken,
123124
this.label,
124125
this.message,
125-
String? memo,
126-
String? reference,
126+
super.memo,
127+
super.reference,
127128
}) : super(
128129
type: RequestType.transfer,
129-
network: network,
130-
memo: memo,
131-
reference: reference,
132130
);
133131

134132
@override
@@ -154,14 +152,11 @@ class TransactionRequest extends PaymentRequest {
154152

155153
const TransactionRequest({
156154
required this.transaction,
157-
required SVMNetwork network,
158-
String? memo,
159-
String? reference,
155+
required super.network,
156+
super.memo,
157+
super.reference,
160158
}) : super(
161159
type: RequestType.transaction,
162-
network: network,
163-
memo: memo,
164-
reference: reference,
165160
);
166161

167162
@override

flutter_sdk/test/bug_fixes_test.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// Bug Fixes Test Suite
22
///
33
/// Comprehensive tests for critical bug fixes in the Flutter SDK.
4+
library;
45

56
import 'package:flutter_test/flutter_test.dart';
67
import 'package:svm_pay/src/svm_pay_sdk.dart';
@@ -39,13 +40,13 @@ void main() {
3940

4041
group('Bug #2: Race Condition Prevention', () {
4142
test('concurrent payment requests are handled safely', () async {
42-
final request1 = TransferRequest(
43+
const request1 = TransferRequest(
4344
recipient: '11111111111111111111111111111112',
4445
amount: '1.0',
4546
network: SVMNetwork.solana,
4647
);
4748

48-
final request2 = TransferRequest(
49+
const request2 = TransferRequest(
4950
recipient: '11111111111111111111111111111112',
5051
amount: '2.0',
5152
network: SVMNetwork.solana,
@@ -141,7 +142,7 @@ void main() {
141142
expect(svmPay.parseUrl(longUrl), isNull);
142143

143144
// Test URLs with path traversal attempts
144-
final maliciousUrl = 'solana://address?amount=../../../etc/passwd';
145+
const maliciousUrl = 'solana://address?amount=../../../etc/passwd';
145146
final result = svmPay.parseUrl(maliciousUrl);
146147
expect(result, isNull);
147148

@@ -154,7 +155,7 @@ void main() {
154155
expect(svmPay.parseUrl(excessiveUrl), isNull);
155156

156157
// Test valid URL still works
157-
final validUrl = 'solana://11111111111111111111111111111112?amount=1.0';
158+
const validUrl = 'solana://11111111111111111111111111111112?amount=1.0';
158159
expect(svmPay.parseUrl(validUrl), isNotNull);
159160
});
160161
});
@@ -215,7 +216,7 @@ void main() {
215216
'private: [REDACTED] and token: [REDACTED]'),
216217
];
217218

218-
for (final (input, expected) in testCases) {
219+
for (final (input, _) in testCases) {
219220
// We need to access the private method through a test-specific approach
220221
// This is a simplified test - in practice, we'd test through public methods
221222
expect(input.contains('11111111111111111111111111111112') ||

flutter_sdk/test/integration_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:flutter/services.dart';
21
import 'package:flutter_test/flutter_test.dart';
32
import 'package:integration_test/integration_test.dart';
43
import 'package:svm_pay/svm_pay.dart';
@@ -352,9 +351,9 @@ void main() {
352351

353352
testWidgets('should handle large data efficiently', (tester) async {
354353
// Test with maximum allowed string lengths
355-
const maxLabel = 'a' * 200;
356-
const maxMessage = 'b' * 500;
357-
const maxMemo = 'c' * 100;
354+
final maxLabel = 'a' * 200;
355+
final maxMessage = 'b' * 500;
356+
final maxMemo = 'c' * 100;
358357

359358
final stopwatch = Stopwatch()..start();
360359

0 commit comments

Comments
 (0)