You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the method, when RequestOptions is formed, compose is called, and then copyWith, and that's the problem.
A cancelToken is attached to RequestOptions in compose.
When calling copyWith, a new RequestOptions is created, but the old cancelToken is passed, which is linked to the RequestOptions itself.
Because of this, when canceling via CancelToken, we will not get the working RequestOptions, but rather the initial RequestOptions, which will contain almost nothing.
In order to avoid this, you need to add a line before calling the fetch function.
cancelToken.requestOptions = _options;
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
In the method, when RequestOptions is formed, compose is called, and then copyWith, and that's the problem.
A cancelToken is attached to RequestOptions in compose.
When calling copyWith, a new RequestOptions is created, but the old cancelToken is passed, which is linked to the RequestOptions itself.
Because of this, when canceling via CancelToken, we will not get the working RequestOptions, but rather the initial RequestOptions, which will contain almost nothing.
In order to avoid this, you need to add a line before calling the fetch function.
Beta Was this translation helpful? Give feedback.
All reactions