Skip to content

Commit

Permalink
Revert removed download for DioMixin (#1916)
Browse files Browse the repository at this point in the history
See https://github.com/cfug/dio/pull/1772/files#r1281588318.

Fixes parse-community/Parse-SDK-Flutter#958.

### New Pull Request Checklist

- [x] I have read the
[Documentation](https://pub.dev/documentation/dio/latest/)
- [x] I have searched for a similar pull request in the
[project](https://github.com/cfug/dio/pulls) and found none
- [x] I have updated this branch with the latest `main` branch to avoid
conflicts (via merge from master or rebase)
- [ ] I have added the required tests to prove the fix/feature I'm
adding
- [ ] I have updated the documentation (if necessary)
- [x] I have run the tests without failures
- [x] I have updated the `CHANGELOG.md` in the corresponding package

---------

Signed-off-by: Alex Li <github@alexv525.com>
  • Loading branch information
AlexV525 committed Aug 2, 2023
1 parent 0c75d50 commit 0b87202
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ See the [Migration Guide][] for the complete breaking changes list.**

## Unreleased

*None.*
- Revert removed `download` for `DioMixin`.

## 5.3.1

Expand Down
15 changes: 15 additions & 0 deletions dio/lib/src/dio_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,21 @@ abstract class DioMixin implements Dio {
);
}

@override
Future<Response> download(
String urlPath,
dynamic savePath, {
ProgressCallback? onReceiveProgress,
Map<String, dynamic>? queryParameters,
CancelToken? cancelToken,
bool deleteOnError = true,
String lengthHeader = Headers.contentLengthHeader,
Object? data,
Options? options,
}) {
throw UnimplementedError();
}

@override
Future<Response<T>> requestUri<T>(
Uri uri, {
Expand Down
9 changes: 9 additions & 0 deletions dio/test/dio_mixin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@ void main() {
);
expect(typedResponse.data, isNull);
});

test('throws UnimplementedError when calling download', () {
expectLater(
() => _TestDioMixin().download('a', 'b'),
throwsA(TypeMatcher<UnimplementedError>()),
);
});
}

class _TestDioMixin with DioMixin implements Dio {}

0 comments on commit 0b87202

Please sign in to comment.