Closed noisytempo closed 5 years ago
@noisytempo Please change the code to:
import "dart:async";
import 'package:jaguar_resty/jaguar_resty.dart' as resty;
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:rozana_api_service/data/model/dto/credentials.dart';
import 'package:rozana_api_service/data/model/dto/customer.dart';
part 'auth_api_service.jretro.dart';
@GenApiClient(path: "api")
class AuthApiService extends ApiClient with _$AuthApiServiceClient {
final resty.Route base;
AuthApiService({this.base, CodecRepo jsonConverter}) {
this.jsonConverter = jsonConverter;
}
@PostReq(path: "register")
Future registerCustomer(@asjson() Customer Customer);
@PostReq(path: "authenticate")
Future authenticateUser(@asjson() Credentials credentials);
}
@tejainece The code you have mentioned above still does not solve the issue. I am still getting the issue mentioned above on the fresh run but on hot reload, the issue seems to go away and final converters = <String, CodecRepo>{};
gets populated on hot reload and not when the code is executed for the first time
After Flutter clean
, this issue is now resolved. Thanks 🙂
Awesome!
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Exception: Converter for content type 'application/pdf' not found!
E/flutter ( 8390): #0 ApiClient.decodeOne (package:jaguar_retrofit/client/client.dart:23:7)
E/flutter ( 8390):
Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17134.829], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [√] Android Studio (version 3.4) [√] Connected device (1 available)
• No issues found!
E/flutter (12053): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception: E/flutter (12053): Exception: Converter for content type 'application/json' not found! E/flutter (12053): #0 ApiClient.decodeOne (package:jaguar_retrofit/client/client.dart:23:7) E/flutter (12053):
E/flutter (12053): #1 _RootZone.runUnary (dart:async/zone.dart:1379:54)
E/flutter (12053): #2 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
E/flutter (12053): #3 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
E/flutter (12053): #4 Future._propagateToListeners (dart:async/future_impl.dart:671:32)
E/flutter (12053): #5 Future._complete (dart:async/future_impl.dart:476:7)
E/flutter (12053): #6 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter (12053): #7 _AsyncAwaitCompleter.complete. (dart:async/runtime/libasync_patch.dart:33:20)
E/flutter (12053): #8 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (12053): #9 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
Current implementation of the api-service file is as below: import "dart:async";
import 'package:jaguar_resty/jaguar_resty.dart' as resty; import 'package:jaguar_retrofit/jaguar_retrofit.dart'; import 'package:jaguar_serializer/jaguar_serializer.dart'; import 'package:rozana_api_service/data/model/dto/credentials.dart'; import 'package:rozana_api_service/data/model/dto/customer.dart';
part 'auth_api_service.jretro.dart';
@GenApiClient(path: "api") class AuthApiService extends ApiClient with _$AuthApiServiceClient { final resty.Route base;
final JsonRepo jsonConverter;
AuthApiService({this.base, this.jsonConverter});
@PostReq(path: "register") Future registerCustomer(@AsJson() Customer Customer);
@PostReq(path: "authenticate") Future authenticateUser(@AsJson() Credentials credentials);
}