@@ -50,11 +50,16 @@ class ChargeFlowConfig {
5050 /// Creates a new charge flow configuration.
5151 ///
5252 /// Parameters:
53- /// - [maxAuthenticationAttempts] : Maximum number of authentication attempts (default: 3)
54- /// - [authenticationTimeout] : Time to wait for each authentication (default: 5 minutes)
55- /// - [pollInterval] : Interval between status checks for async payments (default: 10 seconds)
56- /// - [maxPollDuration] : Maximum time to poll async payments (default: 10 minutes)
57- /// - [autoRetryTransientErrors] : Whether to retry transient errors (default: true)
53+ /// - [maxAuthenticationAttempts] : Maximum number of authentication
54+ /// attempts (default: 3)
55+ /// - [authenticationTimeout] : Time to wait for each authentication
56+ /// (default: 5 minutes)
57+ /// - [pollInterval] : Interval between status checks for async payments
58+ /// (default: 10 seconds)
59+ /// - [maxPollDuration] : Maximum time to poll async payments
60+ /// (default: 10 minutes)
61+ /// - [autoRetryTransientErrors] : Whether to retry transient errors
62+ /// (default: true)
5863 /// - [maxRetryAttempts] : Maximum number of retry attempts (default: 2)
5964 const ChargeFlowConfig ({
6065 this .maxAuthenticationAttempts = 3 ,
@@ -331,7 +336,8 @@ class ChargeFlowHelper {
331336 }
332337 }
333338
334- /// Processes a simplified charge flow for payment methods that typically don't require authentication.
339+ /// Processes a simplified charge flow for payment methods that typically
340+ /// don't require authentication.
335341 ///
336342 /// This method is optimized for payment methods like saved cards that
337343 /// usually complete without additional user interaction. It still handles
@@ -360,14 +366,14 @@ class ChargeFlowHelper {
360366 }) async {
361367 const config = ChargeFlowConfig (
362368 maxAuthenticationAttempts: 1 ,
363- authenticationTimeout: const Duration (minutes: 2 ),
364- pollInterval: const Duration (seconds: 5 ),
365- maxPollDuration: const Duration (minutes: 3 ),
369+ authenticationTimeout: Duration (minutes: 2 ),
370+ pollInterval: Duration (seconds: 5 ),
371+ maxPollDuration: Duration (minutes: 3 ),
366372 );
367373
368374 final helper = ChargeFlowHelper (_chargeService, config: config);
369375
370- return await helper.processCompleteFlow (
376+ return helper.processCompleteFlow (
371377 options: options,
372378 onAuthentication:
373379 onAuthentication ?? (type, charge, attempt) async => null ,
@@ -394,7 +400,7 @@ class ChargeFlowHelper {
394400
395401 // Wait before retry with exponential backoff
396402 final delay = Duration (milliseconds: 1000 * (1 << (attempts - 1 )));
397- await Future .delayed (delay);
403+ await Future < dynamic > .delayed (delay);
398404 }
399405 }
400406
@@ -457,7 +463,7 @@ class ChargeFlowHelper {
457463
458464 // Wait before retry
459465 final delay = Duration (milliseconds: 1000 * (1 << (attempts - 1 )));
460- await Future .delayed (delay);
466+ await Future < dynamic > .delayed (delay);
461467 }
462468 }
463469
@@ -492,9 +498,9 @@ class ChargeFlowHelper {
492498 bool _isTransientError (dynamic error) {
493499 if (error is MindException ) {
494500 // Network errors and some server errors are transient
495- return error.code? .contains ('network' ) == true ||
496- error.code? .contains ('timeout' ) == true ||
497- error.code? .contains ('server' ) == true ;
501+ return error.code.contains ('network' ) == true ||
502+ error.code.contains ('timeout' ) == true ||
503+ error.code.contains ('server' ) == true ;
498504 }
499505
500506 // Consider other network-related errors as transient
0 commit comments