Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

type 'ExpandIterable<InterfaceType, MethodElement>' is not a subtype of type 'Iterable<MethodElementImpl>' of 'iterable'

I want to create a api services using dio and build_runner. But when I run flutter pub run build_runner this command on terminal I got this error

[SEVERE] retrofit_generator:retrofit on lib/web_services/api_services.dart:

type 'ExpandIterable<InterfaceType, MethodElement>' is not a subtype of type 'Iterable' of 'iterable'

This is my api services code.

part 'api_services.g.dart';

@RestApi(baseUrl: Preferences.hrmsAPI)
abstract class RestClient {
  factory RestClient(Dio dio) = _RestClient;

  @FormUrlEncoded()
  @GET('config')
  Future<WrappedResponse> config();

  @FormUrlEncoded()
  @GET('profile')
  Future<WrappedResponse> profile(@Header('Authorization') String token);
}
like image 563
Player 2nd Avatar asked Oct 31 '25 17:10

Player 2nd


1 Answers

Reported Issue : https://github.com/trevorwang/retrofit.dart/issues/345

Temp fix:

retrofit_generator:
git:
  url: https://github.com/Chimerapps/retrofit.dart.git
  ref: 9f90296751984b359937c38563da5b19db5550f5
  path: generator

UPDATE

As the Jun 4, 2021 we get new package update, that fix the problem.

retrofit_generator 2.0.0+1
like image 177
Jakub S. Avatar answered Nov 02 '25 10:11

Jakub S.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!