lomsa-com/http-mock-adapter

Library not compatible with flutter 3.16.0 - incorrect type definition

Closed this issue · 3 comments

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: https://github.com/lomsa-dev/http-mock-adapter/blob/e8298ff3e8e669ca44edbe3c41b8b2f0d4303839/lib/src/mixins/request_handling.dart#L32

adgeg commented

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

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

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