Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fluttercandies/flutterjsonbeanfactory
What I do is generate dart beans based on json, as well as generics parameters and json build instances
https://github.com/fluttercandies/flutterjsonbeanfactory
dart flutter flutterjson json
Last synced: 5 days ago
JSON representation
What I do is generate dart beans based on json, as well as generics parameters and json build instances
- Host: GitHub
- URL: https://github.com/fluttercandies/flutterjsonbeanfactory
- Owner: fluttercandies
- License: apache-2.0
- Created: 2018-12-29T04:38:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-06T02:52:29.000Z (25 days ago)
- Last Synced: 2025-01-19T06:02:47.594Z (12 days ago)
- Topics: dart, flutter, flutterjson, json
- Language: Kotlin
- Homepage:
- Size: 92.6 MB
- Stars: 564
- Watchers: 8
- Forks: 56
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# FlutterJsonBeanFactory
Hi,Welcome to come to see me!
What I do is generate dart beans based on json, as well as generics parameters and json build instancesLanguage: English | [中文(qq群963752388)](https://juejin.cn/post/7030739002969817118/)
打扰:我想找份flutter开发的工作,请问有没有大佬可以帮忙推荐一下,谢谢了,我的邮箱:[email protected],安卓ios都会撸,不接受做马甲包的工作
打扰:顺便接flutter外包### Easy Use 插件交流群qq(963752388)
![image](.github/beantojson_factory.gif)
## Known issue
- If "No classes that inherit JsonConvert were found" is displayed, delete the ". Idea "directory under the project and
click" invalidate Caches"in your (Andorid Studio or IDEA) button to restart the IDE## Template ToDo list
- [x] Support for instantiation through generics
- [x] Support customized JSON parsing
- [x] The supported types are: int double String datetime dynamic var, and List of the above types
- [x] Two (and more)-dimensional array is supported (v4.5.6~)
- [x] Support custom generated path### Usage
* 打扰:我想找份flutter开发的工作,请问有没有大佬可以帮忙推荐一下,谢谢了,我的邮箱:[email protected]
* Settings/Preferences > Plugins > Marketplace > Search for "
FlutterJsonBeanFactory" >
Install Plugin
* Restart your Develop tools
* Modify in the YAML file of the Flutter project* Press shortcut key `alt ` + `j` for mac , right click on package -> `New`->`Dart bean clas file from JSON`And Then you
will know how to use
* If you change the fields in the class, just press the shortcut alt + j to regenerate the tojson and fromjson methods.
The generated method regenerates all helper classes and JsonConvert classes (the same as the shortcut alt + j) each
time an entity file is created in the generated/json directory.
* If you need generic conversions in your network requests, use the JsonConvert.fromJsonAsT method directly.
* If no helper files are generated, you can delete the .idea directory and restart your idea
* You can customize the JSON parsing scheme```dart
import 'generated/json/base/json_convert_content.dart';class MyJsonConvert extends JsonConvert {
T? asT(dynamic value) {
try {
String type = T.toString();
if (type == "DateTime") {
return DateFormat("dd.MM.yyyy").parse(value) as T;
} else {
return super.asT(value);
}
} catch (e, stackTrace) {
print('asT<$T> $e $stackTrace');
return null;
}
}
}Future main() async {
jsonConvert = MyJsonConvert();
runApp(Text("OK"));
}
```custom generated path->(pubspec.yaml)
```yaml
flutter_json:
generated_path: src/json/**
```### 开源不易,觉得有用的话可以请作者喝杯冰可乐🥤
### 赞助列表(非常非常的感谢,仅记录此插件收到的打赏,承诺将收到的所有赞助用于购买可乐和赞助其他开源作者)
名称
金额
时间
微信:大熊猫🐱
20元
2024年4月3日
qq:sunny
10元
2023年12月21日
微信:未知
10元
2023年11月17日
QQ:郭嘉
10元
2023年09月12日
QQ:初一
100元
2023年08月15日
Github:cr1992
6.66元
2023年08月4日
QQ:余军
200元
2022年12月
### Find me useful ? :heart:
* Support me by clicking the :star: button on the upper right of this page. :v:
* Spread to others to let more people have a better develope expierience :heart:---
Thanks to [JetBrains](https://www.jetbrains.com/?from=fluttercandies) for allocating free open-source licenses for IDEs
such as [IntelliJ IDEA](https://www.jetbrains.com/idea/?from=fluttercandies).[](https://www.jetbrains.com/?from=fluttercandies)