process method

  1. @override
Future process(
  1. String method,
  2. List? params,
  3. Future next(
    1. String method,
    2. List? params
    )
)
override

Implementation

@override
Future<dynamic> process(
  String method,
  List<dynamic>? params,
  Future<dynamic> Function(String method, List<dynamic>? params) next,
) async {
  Object? lastError;
  for (var attempt = 0; attempt <= maxRetries; attempt++) {
    try {
      return await next(method, params);
    } catch (e) {
      lastError = e;
      if (attempt < maxRetries) {
        await Future<void>.delayed(retryDelay * (attempt + 1));
      }
    }
  }
  throw lastError!;
}