Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library not compatible with flutter 3.16.0 - incorrect type definition #164

Closed
lunakoan opened this issue Nov 22, 2023 · 3 comments · Fixed by #165
Closed

Library not compatible with flutter 3.16.0 - incorrect type definition #164

lunakoan opened this issue Nov 22, 2023 · 3 comments · Fixed by #165
Assignees
Labels
bug Something isn't working

Comments

@lunakoan
Copy link
Contributor

Description

This library cannot be used with flutter 3.16.0 as one of it's functions contains a method call that returns a future which is incorrectly assigned to a different type causing the compilation error.

Steps to reproduce

  1. Install flutter
  2. Use this library - I use DioAdapter like so: DioAdapter dioAdapter = DioAdapter(dio: myDioInstance); dioAdapter.onPost(...);
  3. See error
../../../.pub-cache/hosted/pub.dev/http_mock_adapter-0.6.0/lib/src/mixins/request_handling.dart:32:42: Error: A value of type 'FutureOr<List<int>>' can't be assigned to a variable of type 'List<int>'.
 - 'List' is from 'dart:core'.
          bytes = options.requestEncoder!(data, options);

Expected behavior

Library can be used with no issues.

System details

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.0, on macOS 14.1.1 23B81 darwin-arm64, locale en-NZ)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.84.2)
[✓] Connected device (3 available)
[✓] Network resources

Additional context

Offending line:

bytes = options.requestEncoder!(data, options);

@adgeg
Copy link

adgeg commented Nov 22, 2023

Hello dear mock adapater team :) Exact same error here, while upgrading to 3.16.0.

@LukaGiorgadze
Copy link
Member

LukaGiorgadze commented Nov 23, 2023

Hello dear mock adapater team :) Exact same error here, while upgrading to 3.16.0.

The issue has been fixed and released. Thanks to @willckoan

@RakaAlrian
Copy link

getting exactly same error on version 0.4.4, is there any workaround for older version? I currently use flutter 3.7.0 and cannot upgrade yet because some package conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants