json_config_builder 0.0.6

  • Readme
  • Changelog
  • Installing
  • 59

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.0.1] - 4/8/2020 #

  • Initial Release.

[0.0.2] - 4/8/2020 #

  • Adjusting how the code get's generated.

[0.0.3] - 4/8/2020 #

  • Greatly simplified the expected output.

[0.0.4] - 4/8/2020 #

  • Changed how this builds to build to source instead of cache.

[0.0.5] - 4/9/2020 #

  • Eased up the dependency on build_config to prevent flutter_tool conflicts.

[0.0.6] - 4/10/2020 #

  • Changed build_to to 'source' to avoid missing generated file issues

Use this package as a library

1. Depend on it

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


dependencies:
  json_config_builder: ^0.0.6

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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_config_builder/json_config_builder.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
30
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:json_config_builder/json_config_builder.dart that imports:
  • package:dart_style/dart_style.dart that imports:
  • package:dart_style/src/exceptions.dart that imports:
  • package:analyzer/error/error.dart that imports:
  • package:analyzer/src/generated/source.dart that imports:
  • package:analyzer/src/generated/source_io.dart that imports:
  • package:analyzer/src/generated/java_io.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:json_config_builder/json_config_builder.dart that imports:
  • package:dart_style/dart_style.dart that imports:
  • package:dart_style/src/exceptions.dart that imports:
  • package:analyzer/error/error.dart that imports:
  • package:analyzer/src/generated/source.dart that imports:
  • package:analyzer/src/generated/source_io.dart that imports:
  • package:analyzer/src/generated/java_io.dart that imports:
  • dart:io

Health suggestions

Format lib/json_config_builder.dart.

Run dartfmt to format lib/json_config_builder.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 (build_config).

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_config_builder.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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
build ^1.2.2 1.3.0
build_config >=0.4.1 <0.4.2 0.4.1+1 0.4.2
dart_style ^1.3.4 1.3.6
meta ^1.1.8 1.2.2 1.3.0-nullsafety
Transitive dependencies
_fe_analyzer_shared 5.0.0
analyzer 0.39.12
args 1.6.0
async 2.4.2
charcode 1.1.3
checked_yaml 1.0.2
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
crypto 2.1.5
csslib 0.16.1
glob 1.2.0
html 0.14.0+3
js 0.6.2
json_annotation 3.0.1
logging 0.11.4
node_interop 1.1.1
node_io 1.1.1
package_config 1.9.3
path 1.7.0
pedantic 1.9.2
pub_semver 1.4.4
pubspec_parse 0.1.5
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
watcher 0.9.7+15
yaml 2.2.1
Dev dependencies
indent ^1.0.0+2
test 1.14.2