Skip to content

I am getting build time error when using the plugin. #4

@uc-dve

Description

@uc-dve

dio 4.0.0
dio_retry_fixed: ^0.1.15-beta-null-safety

The issue is inside plugin files here is the error log.

../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:30:32: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
err.request!.extra = err.request!.extra..addAll(extra.toExtra());
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:33:40: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
errorCallback!(ErrorResult(err.request!.uri.toString(), err.message, extra.retries, err.error.toString()));
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:39:15: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
err.request!.path,
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:40:28: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
cancelToken: err.request!.cancelToken,
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:41:21: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
data: err.request!.data,
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:42:34: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
onReceiveProgress: err.request!.onReceiveProgress,
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:43:31: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
onSendProgress: err.request!.onSendProgress,
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:44:32: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
queryParameters: err.request!.queryParameters,
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:45:39: Error: The getter 'request' isn't defined for the class 'DioError'.
- 'DioError' is from 'package:dio/src/dio_error.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/dio_error.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
options: Options(extra: err.request!.extra),
^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:38:16: Error: A value of type 'Response' can't be returned from an async function with return type 'void'.
- 'Response' is from 'package:dio/src/response.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0/lib/src/response.dart').
return await dio.request(
^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:48:16: Error: A value of type 'Object' can't be returned from an async function with return type 'void'.
- 'Object' is from 'dart:core'.
return e;
^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:52:25: Error: Too few positional arguments: 2 required, 1 given.
return super.onError(err);
^
../../.pub-cache/hosted/pub.dartlang.org/dio_retry_fixed-0.1.15-beta-null-safety/lib/src/retry_interceptor.dart:52:18: Error: A value of type 'invalid-type' can't be returned from an async function with return type 'void'.
return super.onError(err);
^
Command PhaseScriptExecution failed with a nonzero exit code
FirebasePerformance-gmrrcesyyvkfjbflfjwkdefehdqi
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Exited (sigterm)

This is my code and there is no issue.

import 'dart:async';
import 'package:dio/dio.dart';
import 'package:dio_retry_fixed/dio_retry_fixed.dart';
// import 'package:dio_firebase_performance/dio_firebase_performance.dart';
// import 'package:dio_retry/dio_retry.dart';
import 'theme_action.dart';
import 'package:path/path.dart' as path;

int _apiCounter = 0;
Dio _dioObj;

Dio get _dio {
  if (_dioObj == null) {
    _dioObj ??= new Dio();
    _dioObj
      ..interceptors.add(RetryInterceptor(
        dio: _dioObj,
        // logger: Logger("Retry"),
        options: RetryOptions(
            retries: 3, // Number of retries before a failure
            retryInterval: const Duration(seconds: 3),
            retryEvaluator: (error) =>
                error.type != DioErrorType.cancel &&
                error.type != DioErrorType.response),
      ));
    // _dioObj.interceptors.add(DioFirebasePerformanceInterceptor());
  }
  return _dioObj;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions