flutter / flutter/flutter-intellij
Feature request: make it easier to start using json_serializable
- Dominant language
- Java
- Stars
- 2k
- Forks
- 356
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 27
Description
*@roughike commented on Feb 10, 2018, 11:00 AM UTC:*
If `json_serializable` is the officially recommended JSON library for Dart / Flutter, it would make sense to make it easier to get started with it.
## A live template for json_serializable models
To create a `json_serializable` model, some amount of boilerplate code is required from the user. A live template makes the process much more convenient.
It would look something like this:
[](https://user-images.githubusercontent.com/13744304/35940545-37dd2748-0c58-11e8-8f68-50e0f0cadb1a.gif)
## Quick fixes for running code generation utility and adding needed dependencies
Here's the flow from the users point of view:
* create a `json_serializable` model class with the live template
* the `User` class has a squiggly red line under the name, saying "Code not generated yet"
* user presses Alt-Enter and sees a quick fix option called "Generate code for json_serializable model"
By hitting enter, the following steps would be done:
* Check if the `json_serializable` package is declared in pubspec file. If not, add it automatically and refresh the dependencies.
* Run `flutter packages pub run build_runner build` to build the generated code.
*This issue was moved by [Hixie](https://github.com/Hixie) from flutter/flutter/issues/14623.*
Contributor guide
Assessment
This issue has not been assessed yet.