json_config_builder 0.0.6 copy "json_config_builder: ^0.0.6" to clipboard
json_config_builder: ^0.0.6 copied to clipboard

A builder to create a configuration dart file from a json spec

Config Builder #

A builder to create a configuration dart file from a json spec

Getting Started #

Create a configuration json file using the name template example.config.json that only uses first level fields and single primitive type arrays.

Example #

{
  "apiUrl": "https://example.com",
  "maxDownloads": 5,
  "friction": 2.54321,
  "logging": true,
  "messages": [
    "message1", 
    "message2", 
    "message3"
  ]
}

Will output something like this:

Config() {
  Config._();
  
  static String apiUrl = "https://example.com";
  static int maxDownloads = 5;
  static double friction = 2.54321;
  static bool logging = true;
  static List<String> messages = [
    "message1",
    "message2",
    "message3",
  ];
}

You can then import it via:

import 'package:your_package_name/config.dart';

Usage #

In your pubspec.yaml:

name: example

...

builders:
  json_config_builder: ^0.0.4
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A builder to create a configuration dart file from a json spec

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

build, build_config, dart_style, meta

More

Packages that depend on json_config_builder