json_conditional 1.0.2

  • Readme
  • Changelog
  • Installing
  • 66

json_conditional #

Library that provides a Conditional class that can be used to perform dynamic evaluations. The Conditional class can be constructed directly, or the Conditional.fromDynamic static function can be used to build one from a Map-like object (such as what results form json.decode(...)).

Using the library #

Add the repo to your Flutter pubspec.yaml file.

dependencies:
  json_conditional: <<version>> 

Then run...

flutter packages get

Example #

import 'dart:convert';
import 'package:json_conditional/json_conditional';

// ...

var conditional = Conditional.fromDynamic(json.decode(someJsonString));
var values = json.decode(someOtherJsonString);

if (conditional.evaluate(values)) {
  // do something
} else {
  // do something else
}

[1.0.2] - June 24th, 2020 #

  • Documentation enhancements
  • Defaulted to EvaluationMode.and when using Conditional.fromDynamic as was always intended

[1.0.1] - June 16th, 2020 #

  • Fixed dependencies to work with Dart SDK w/o requiring Flutter

[1.0.0+1] - June 8th, 2020 #

  • Switched to GH action for publishing

[1.0.0] - June 8th, 2020 #

  • Initial release

Use this package as a library

1. Depend on it

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


dependencies:
  json_conditional: ^1.0.2

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_conditional/json_conditional.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
37
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14

Maintenance suggestions

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_conditional.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
json_class ^1.0.0 1.0.3
meta ^1.1.8 1.2.2 1.3.0-nullsafety
Transitive dependencies
logging 0.11.4
Dev dependencies
test any
test_coverage any