Open Clearlove2015 opened 2 weeks ago
The issue maybe related dart_mappable/issues/82, can you provide a sample project.
The issue maybe related dart_mappable/issues/82, can you provide a sample project.
Because by dart_mappable
toJson return value defined is a String, but Retrofit requires a Map.
This issue is exactly what is discussed in the above issues.
If you want the return value to be a Map, you can open Setting -> Tools -> DartMappable Settings
switch the generation format to Custom, or change implement to freezed
or json_serializable
.
Because by
dart_mappable
toJson return value defined is a String, but Retrofit requires a Map. This issue is exactly what is discussed in the above issues. If you want the return value to be a Map, you can openSetting -> Tools -> DartMappable Settings
switch the generation format to Custom, or change implement tofreezed
orjson_serializable
.
I have implemented freezed, json_serializable,dart_mappable_custom three methods, except for dart_mappable_mixin,only dart_mappable_mixin method use @Body with bean has error
The reason for the different return value definitions is given in https://github.com/schultek/dart_mappable/issues/82.
If you must use dart_mappable_mixin refer to the configuration in https://github.com/schultek/dart_mappable/issues/82#issuecomment-1536427459. I have not used this method.
The reason for the different return value definitions is given in schultek/dart_mappable#82. If you must use dart_mappable_mixin refer to the configuration in schultek/dart_mappable#82 (comment). I have not used this method.
It' OK, thank you ! haha https://github.com/schultek/dart_mappable/issues/82#issuecomment-1628823193 https://github.com/schultek/dart_mappable/issues/82#issuecomment-1971866982 https://github.com/rydmike/mapper_issue
but this plugin mixin generated code need to update, eg:
Do you have any better suggestions for generating code for the mixin plugin?
You can configure it to only rename toJson and toMap, so it won't affect the code generated by the plugin.
global_options:
dart_mappable_builder:
options:
renameMethods:
# fromJson: deserialize
# fromMap: fromJson
toJson: serialize
toMap: toJson
You can configure it to only rename toJson and toMap, so it won't affect the code generated by the plugin.
global_options: dart_mappable_builder: options: renameMethods: # fromJson: deserialize # fromMap: fromJson toJson: serialize toMap: toJson
This is a good idea,thank you!
error log1: [🔔 Dio] LoginReq cannot be used to imply a default content-type, please set a proper content-type in the request.
error log2: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: DioException [bad response]: This exception was thrown because the response has a status code of 400 and RequestOptions.validateStatus was configured to throw for this status code. The status code of 400 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled" Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code.
0 DioMixin.fetch (package:dio/src/dio_mixin.dart:520:7)