json_dynamic_widget_plugin_expressions 1.0.0+4 copy "json_dynamic_widget_plugin_expressions: ^1.0.0+4" to clipboard
json_dynamic_widget_plugin_expressions: ^1.0.0+4 copied to clipboard

discontinuedreplaced by: json_dynamic_widget

A plugin to the JSON Dynamic Widget to provide Font Awesome support to the widgets

json_dynamic_widget_plugin_expressions #

DISCONTINUED: the functionality provided by this plugin has been added to the base json_dynamic_widget package as of 4.0.0. This plugin is no longer needed and will no longer be maintained.

Table of Contents #

Live Example #

Introduction #

Plugin to the JSON Dynamic Widget to provide expressions support utilizing the fantastic expressions package.

Using the Plugin #

import 'package:json_dynamic_widget/json_dynamic_widget.dart';
import 'package:json_dynamic_widget_plugin_expressions/json_dynamic_widget_plugin_expressions.dart';


void main() {
  // Ensure Flutter's binding is complete
  WidgetsFlutterBinding.ensureInitialized();

  // ...

  // Get an instance of the registry
  var registry = JsonWidgetRegistry.instance;

  // Bind the plugin to the registry.  This is necessary for the registry to
  // find the function provided by the plugin
  JsonExpressionsPlugin.bind(registry);

  // ...
}

Once you have bound the plugin, you the expression function will be exposed. When using the expression function, you need to fully use the syntax from the expressions. All variables and functions from the registry will be exposed to that syntax, but it differs from the syntax of the functions and variables from JsonDynamicWidget.

For instance, you can do the following...

registry.setValue('x', 2);
registry.setValue('y', 4);
registry.registerFunction(
  'add',
  ({args, required registry}) => args![0] + args[1],
);

And then the result of this JSON:

{
  "type": "text",
  "args": {
    "text": "##expression(add(x+y))##
  }
}

... will result in 6 being printed out.

0
likes
140
points
3
downloads

Publisher

verified publisherpeifferinnovations.com

Weekly Downloads

A plugin to the JSON Dynamic Widget to provide Font Awesome support to the widgets

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

child_builder, expressions, flutter, json_class, json_dynamic_widget, json_theme, logging, meta, uuid

More

Packages that depend on json_dynamic_widget_plugin_expressions