json_forms 0.0.2

json_forms #

A package to make forms faster. Just write a JSON file and the Widgets will be generated

Getting Started #

Usage #

Widget widget = JsonForm.fromJson(yourJson);

Available question's types :

  • Text
  • Number
  • Bool
  • Radio
  • Pick
  • CheckTable
  • OptionalQuantityTable (yes, I could have found a better name :) )

Example of JSON file

{ // Form Object
  "name": "The form's name",
  "sections": [ // List of Section objects
      "name": "Name of the first section",
	  "questions": [ // List of Question Object
		  "id": 0,
		  "text": "What's your name ?",
		  "type": "Text",
		  "value": null,
		  "possibilities": null,
		  "condition": null,
		  "placeholder": "Name",
		  "invalidMessageKey": "The field is empty, please put your name",
		  "isRequired": true
		  "id": 1,
		  "text": "What's your gender ?",
		  "type": "Radio",
		  "value": "male",
		  "possibilities": [
		  "condition": null,
		  "invalidMessageKey": "empty",
		  "isRequired": false
		  "id": 2,
		  "text": "How old are you ?",
		  "type": "Number",
		  "value": null,
		  "possibilities": null,
		  "condition": {
		    "questionId": 1,
		    "value": "male"
		  "placeholder": "Your age",
		  "invalidMessageKey": "empty",
		  "isRequired": false
	  "name": "Name of the second section",
		  "id": 3,
		  "text": "Do you have any pets ?",
		  "type": "CheckTable",
		  "value": ["cat", "snake"],
		  "possibilities": ["cat", "dog", "snake", "spider", "bird", "fish", "rabbit"],
		  "condition": null,
		  "invalidMessageKey": "empty",
		  "isRequired": false
		  "id": 4,
		  "text": "What is the color of your fish ?",
		  "type": "Pick",
		  "value": "blue",
		  "possibilities": ["blue", "black", "red", "yellow", "green"],
		  "condition": {
		  "questionId": 3,
						"value": "fish"
					"invalidMessageKey": "empty",
					"isRequired": false
					"id": 5,
					"text": "Do you like this form ?",
					"type": "Bool",
					"value": false,
					"possibilities": null,
					"condition": null,
					"isRequired": false
					"id": 6,
					"text": "Rate this form",
					"type": "Radio",
					"value": 4,
					"possibilities": [1,2,3,4,5],
					"condition": null,
					"isRequired": false
			"name": "Last section",
			"questions": [
					"id": 7,
					"text": "Do you have any pets ?",
					"type": "OptionalQuantityTable",
					"value": null,
					"possibilities": ["cat", "dog", "fish"],
					"condition": null,
					"invalidMessageKey": "empty",
					"isRequired": false

[0.0.1] - 08/02

First release of the package

[0.0.2] - 08/05

Added a readonly feature

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  json_forms: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:json_forms/json_forms.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Aug 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/QuestionWidget.dart. (-1 points)

Analysis of lib/QuestionWidget.dart reported 2 hints:

line 2 col 8: Unused import: 'package:provider/provider.dart'.

line 6 col 8: Unused import: 'FormProvider.dart'.

Fix lib/QuestionTypes/NumberQuestion.dart. (-0.50 points)

Analysis of lib/QuestionTypes/NumberQuestion.dart reported 1 hint:

line 3 col 8: Unused import: '../Classes.dart'.

Fix lib/QuestionTypes/OptionalQuantityTable.dart. (-0.50 points)

Analysis of lib/QuestionTypes/OptionalQuantityTable.dart reported 1 hint:

line 3 col 8: Unused import: '../Classes.dart'.

Fix additional 10 files with analysis or formatting issues. (-2 points)

Additional issues in the following files:

  • lib/QuestionTypes/PickQuestion.dart (1 hint)
  • lib/QuestionTypes/RadioQuestion.dart (1 hint)
  • lib/QuestionTypes/TextQuestion.dart (1 hint)
  • lib/SectionWidget.dart (1 hint)
  • lib/Classes.dart (Run flutter format to format lib/Classes.dart.)
  • lib/FormProvider.dart (Run flutter format to format lib/FormProvider.dart.)
  • lib/FormWidget.dart (Run flutter format to format lib/FormWidget.dart.)
  • lib/QuestionTypes/BoolQuestion.dart (Run flutter format to format lib/QuestionTypes/BoolQuestion.dart.)
  • lib/QuestionTypes/CheckTableQuestion.dart (Run flutter format to format lib/QuestionTypes/CheckTableQuestion.dart.)
  • lib/json_forms.dart (Run flutter format to format lib/json_forms.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (json_annotation).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and json_forms.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
json_annotation ^2.4.0 2.4.0 3.0.0
provider ^3.0.0+1 3.0.0+1
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies