json_conditional 2.1.1+1 copy "json_conditional: ^2.1.1+1" to clipboard
json_conditional: ^2.1.1+1 copied to clipboard

A library to create conditional evaluators from JSON or JSON-like structures.

Table of Contents

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

JSON #

{
  "conditions": <Conditional[]>,
  "mode": <String>,
  "values": <Map<String, dynamic>>
}

Either the conditions or the values must be omitted. The mode must be either and or or, and defaults to and when not set.

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
likes
0
pub points
64%
popularity

Publisher

verified publisherpeifferinnovations.com

A library to create conditional evaluators from JSON or JSON-like structures.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

json_class, meta

More

Packages that depend on json_conditional