Last updated:
0 purchases
json conditional
Table of Contents
json_conditional
Using the library
JSON
Example
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>>
copied to clipboard
Then run...
flutter packages get
copied to clipboard
JSON #
{
"conditions": <Conditional[]>,
"mode": <String>,
"values": <Map<String, dynamic>>
}
copied to clipboard
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
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.