This guide is primarily for users with prior dio 3.x experience who want to learn about the new features and changes in dio 4.x .
- Interceptors: Add
handler
for Interceptor APIs which can specify the subsequent interceptors processing logic more finely(whether to skip them or not)) - Support multiple encoding styles (
options.listFormat
) for requestList
parameters. - Make keys of request headers be case-insensitive.
- New API:
Future<Response> dio.fetch( RequestOptions )
. - New API:
RequestOptions options.compose(BaseOptions baseOpt,...)
.
-
Null safety support (Dart >=2.12).
-
The
Interceptor
APIs signature has changed. -
Rename
options.merge
tooptions.copyWith
. -
Rename
DioErrorType
enums from uppercase to camel style. -
Delete
dio.resolve
anddio.reject
APIs (usehandler
instead in interceptors). -
Class
BaseOptions
no longer inherits fromOptions
class. -
Change
requestStream
type ofHttpClientAdapter.fetch
fromStream<List<int>>
toStream<Uint8List>
. -
Download API: Add real uri and redirect information to headers.