admin管理员组文章数量:1335611
While generating build this exception is thrown and unable to comple buildin fluter file using MultipartFile in Retrofit Multipart
@POST("upload")
@MultiPart()
Future<UploadFileResponse> uploadWallpaperImage(
@Part(name: "files") MultipartFile wallpaperImage,
@Query("populate") String populate
);
here is the logs
Deprecated. Use `dart run` instead.
Building package executable... (1.0s)
Built build_runner:build_runner.
[INFO] Generating build script completed, took 900ms
[INFO] Reading cached asset graph completed, took 391ms
[INFO] Checking for updates since last build completed, took 1.4s
[SEVERE] retrofit_generator on lib/data/network/api/wallpaper_api.dart:
Exception: toJson() method have to add to MultipartFile
[WARNING] No actions completed for 17.0s, waiting on:
- json_serializable on lib/data/data_sources/wallpaper_remote_data_source.dart
- json_serializable on lib/app/app.dart
- json_serializable on lib/presentation/pages/home/home.dart
- json_serializable on lib/presentation/route/page_route.dart
- json_serializable on lib/presentation/pages/profile/profile.dart
.. and 9 more
[INFO] Running build completed, took 32.1s
[INFO] Caching finalized dependency graph completed, took 558ms
[SEVERE] Failed after 32.7s
I am working on flutter web application project cannot know how to handle correctly and unsing file_picker unable to get access of file path, so i am using MultipartFile.
While generating build this exception is thrown and unable to comple buildin fluter file using MultipartFile in Retrofit Multipart
@POST("upload")
@MultiPart()
Future<UploadFileResponse> uploadWallpaperImage(
@Part(name: "files") MultipartFile wallpaperImage,
@Query("populate") String populate
);
here is the logs
Deprecated. Use `dart run` instead.
Building package executable... (1.0s)
Built build_runner:build_runner.
[INFO] Generating build script completed, took 900ms
[INFO] Reading cached asset graph completed, took 391ms
[INFO] Checking for updates since last build completed, took 1.4s
[SEVERE] retrofit_generator on lib/data/network/api/wallpaper_api.dart:
Exception: toJson() method have to add to MultipartFile
[WARNING] No actions completed for 17.0s, waiting on:
- json_serializable on lib/data/data_sources/wallpaper_remote_data_source.dart
- json_serializable on lib/app/app.dart
- json_serializable on lib/presentation/pages/home/home.dart
- json_serializable on lib/presentation/route/page_route.dart
- json_serializable on lib/presentation/pages/profile/profile.dart
.. and 9 more
[INFO] Running build completed, took 32.1s
[INFO] Caching finalized dependency graph completed, took 558ms
[SEVERE] Failed after 32.7s
I am working on flutter web application project cannot know how to handle correctly and unsing file_picker unable to get access of file path, so i am using MultipartFile.
Share Improve this question edited Nov 20, 2024 at 7:21 VLAZ 29.1k9 gold badges63 silver badges84 bronze badges asked Nov 19, 2024 at 23:07 63 - Vikas Kumar 4rd Sem.63 - Vikas Kumar 4rd Sem. 112 bronze badges1 Answer
Reset to default 0//note that the File is coming from dart:io
@POST("upload")
@MultiPart()
Future<UploadFileResponse> uploadWallpaperImage(
//replace MultipartFile with File
@Part(name: "files") File wallpaperImage,
@Query("populate") String populate
);
本文标签: flutterException toJson() method have to add to MultipartFileStack Overflow
版权声明:本文标题:flutter - Exception: toJson() method have to add to MultipartFile - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742392899a2466342.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论