Plugin Icon if
  • Code Tools

FlutterJsonBeanFactory

Обновлено:
5 месяцев назад
Версия:

5.2.4

Обзор
Версии

Обзор


Json to dart beans are provided, and dart files ending in entity are provided to generate dart bean factory for use.

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

Usage

  • 打扰:我想找份flutter开发的工作,请问有没有大佬可以帮忙推荐一下,谢谢了,我的邮箱:157418979@qq.com

  • 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 JSONAnd 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

import 'generated/json/base/json_convert_content.dart';class MyJsonConvert extends JsonConvert { T? asT<T extends Object?>(dynamic value) { try { String type = T.toString(); if (type == "DateTime") { return DateFormat("dd.MM.yyyy").parse(value) as T; } else { return super.asT<T>(value); } } catch (e, stackTrace) { print('asT<$T> $e $stackTrace'); return null; } }}Future<void> main() async { jsonConvert = MyJsonConvert(); runApp(Text("OK"));}

custom generated path->(pubspec.yaml)

flutter_json: generated_path: src/json/**

Версии

Версия
Диапазон совместимости
Дата обновления
2024
5.2.2
232 — 243.*
26.12.2024
Скачать
5.1.7
212+
18.06.2024
Скачать
2025
5.2.4
232 — 243.*
20.03.2025
Скачать
Plugin ID:
com.ruiyu.ruiyu
icon