Open Dekhant opened 1 year ago
Describe the bug generating fromJson to basic types.
I have this request
@GET('/groups') Future<Map<String, List<int>>> getGroups( @Header('Authorization') String accessToken, );
and this is output that generated by retrofit:
@override Future<Map<String, List<int>>> getGroups(String accessToken) async { const _extra = <String, dynamic>{}; final queryParameters = <String, dynamic>{}; final _headers = <String, dynamic>{r'Authorization': accessToken}; _headers.removeWhere((k, v) => v == null); final Map<String, dynamic>? _data = null; final _result = await _dio.fetch<Map<String, dynamic>>( _setStreamType<Map<String, List<int>>>(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, '/groups', queryParameters: queryParameters, data: _data, ) .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl))); var value = _result.data!.map((k, dynamic v) => MapEntry( k, (v as List) .map((i) => int.fromJson(i as Map<String, dynamic>)) .toList())); return value; }
and error appears in this line:
int.fromJson(i as Map<String, dynamic>))
Same thing with Map: (json) => Map<dynamic, dynamic>.fromJson(json as Map<String, dynamic>)
Describe the bug generating fromJson to basic types.
I have this request
and this is output that generated by retrofit:
and error appears in this line: