A CLI tool to help generate dart classes from json returned from API

Overview

Json 2 Dart Command line utility

Important note

There is already a package called json2dart so this package will be called json2dartc !

This project was made using javiercbk's json_to_dart package ! This CLI was made to directly convert JSON stuctures into Dart classes . I personally don't like build runners and json serializers so I made this for my workflow . Feel free to open issues and submit PRs .

How to use

Install this via pub

pub global activate json2dartc

Example

json2dartc -u https://reqres.in/api/users -m get -e data -n Example

Null safety

To turn on null safe code generation , add the flag --null-safe , Example :

json2dartc -u https://reqres.in/api/users -m get -n Example --null-safe

Options

-u, --api        API Endpoint required to grab the json from
-e, --entry      Entry point for json data structure , e.g data.data will get the nested data array/object from API response
-n, --name       Name of your data class
                 (defaults to "AutoGenerated")
-h, --headers    Headers for your API endpoint
-m, --method     Method for http request , defaults to GET
                 (defaults to "GET")
Option required default example note
-u true required field https://reqres.in/api/users
-e false '' data it's used for special access in json data , e.g data.data will access nested data object within data object
-n false 'AutoGenerated' Example
-h false {} access-token=01234,foo=bar
-m false GET GET/POST

Upcoming plans

  • Null safety support
  • Tool itself written with null safety
  • Private memmbers option
  • Option to load json from a file
You might also like...

Provides API to generate Dart source code

DartWriter DartWriter provides API to generate Dart source code. It can make your job easier while developing flutter/dart tools. You can also generat

Oct 24, 2022

Dart Code Generator for generating mapper classes

Smartstruct - Dart bean mappings - the easy nullsafe way! Code generator for generating type-safe mappers in dart, inspired by https://mapstruct.org/

Nov 29, 2022

Contains utility functions and classes in the style of dart:collection to make working with collections easier

The collection package for Dart contains a number of separate libraries with utility functions and classes that makes working with collections easier.

Dec 27, 2022

Cache json map to local file with Dart:io. Read file with sync api.

local_cache_sync 一个非常简单易用的Flutter本地储存库,适用于在本地储存一列轻量数据(例如用户保存在本地的设备信息,或者缓存一系列用户信息)。 local_cache_sync的所有方法都是同步,而不是异步的。这意味着你不需要使用await就可以获取数据。在flutter中,这

Jun 24, 2022

A CLI for syncing Dart dependency versions between pubspec.yaml and pubspec.lock files.

lockpick A CLI for syncing Dart dependency versions between pubspec.yaml and pubspec.lock files. 🔒 Usage # Activate lockpick pub global activate lock

Oct 17, 2022

A mobile map based application to help people everywhere around the world get help

Wonder This is a mobile application made by flutter. The application is called "Wonder" because it will help people everywhere around the world to get

Dec 2, 2021

JSON API parser for Flutter

JSON API parser for Flutter

Flutter Japx - JSON:API Decoder/Encoder Lightweight [JSON:API][1] parser that flattens complex [JSON:API][1] structure and turns it into simple JSON a

Dec 20, 2022

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

fvm Flutter Version Management: A simple cli to manage Flutter SDK versions. FVM helps with the need for a consistent app builds by allowing to refere

Jan 8, 2023

CLI utility to manage MC Server installations

CLI utility to manage MC server installations. Features Install required JDKs Download server files Generate start scripts (with optimized JVM flags)

Nov 18, 2022
Owner
Adib Mohsin
I make frontend stuff with dart and javascript
Adib Mohsin
A CLI tool to help batch renaming files.

batch_rename A CLI tool to enable batch renaming of files. Installation Clone the repo and add bin/batch_rename.exe to PATH: gh repo clone POWRFULCOW8

Diego Domínguez Melo 0 Nov 3, 2021
Automatically generate usecase classes from your repository class definition in Dart and Flutter

Repo Case Automatically generate usecase classes from your repository class definition in Dart and Flutter. Check out the official guide on repo_case

Sandro Maglione 5 Jul 30, 2022
Converts SVG icons to OTF font and generates Flutter-compatible class. Provides an API and a CLI tool.

Fontify The Fontify package provides an easy way to convert SVG icons to OpenType font and generate Flutter-compatible class that contains identifiers

Igor Kharakhordin 88 Oct 28, 2022
An auto mapper for Dart. It allows mapping objects of different classes automatically and manually using JSON serialization.

AutoMapper for Dart An auto mapper for Dart. It allows mapping objects of different classes automatically and manually using JSON serialization. Examp

Leynier Gutiérrez González 7 Aug 24, 2022
A cli tool to run Flutter applications and auto hot reload it when files are changed

Dashmon A minimalistic CLI tool to run Flutter applications and auto hot reload it when files are changed. It will watch changes your application code

Erick 31 Oct 6, 2022
Simple CLI tool to produce icons for your next app.

icon_set_generator Simple CLI tool to enable easy production of icon sets for your next application. Installation Clone the repo and add bin/icon_set_

Diego Domínguez Melo 1 Nov 17, 2021
A flutter package with classes to help testing applications using the canvas

Canvas test helpers MockCanvas is a utility class for writing tests for canvas operations. It supports the same API as the regular Canvas class from d

Blue Fire 12 Jan 31, 2022
Provides null-safety implementation to simplify JSON data handling by adding extension method to JSON object

Lazy JSON Provides null-safety implementation to simplify JSON data handling by adding extension method to JSON object and JSON array. Getting started

Kinnara Digital Studio 0 Oct 27, 2021
🔍 👀 CLI utility to check last-visit of your CodeForces friends & much more, 🚀 powered by CodeForces API

JoJo ?? ?? CLI utility to check last-visit of your CodeForces friends & much more, ?? powered by CodeForces API Features Online Friends All Friends Pr

Tirth 5 Jul 20, 2020
library to help you create database on local memory, support json local database inspired by lowdb

Licensed Licensed under the MIT License <http://opensource.org/licenses/MIT>. SPDX-License-Identifier: MIT Copyright (c) 2021 Azkadev <http://github.c

Azka Full Snack Developer:) 35 Oct 17, 2022