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

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

🛡️ Fork — Jeff Peiffer Legacy (jpl_) #

Este paquete (jpl_json_dynamic_widget_plugin_expressions) es un fork de json_dynamic_widget_plugin_expressions, originalmente creado por Jeff Peiffer y archivado (read-only) junto con toda la org peiffer-innovations.

El prefijo jpl_ significa Jeff Peiffer Legacy: mantenemos vivo el legado de estos paquetes, bumpeados a las últimas versiones de Dart/Flutter, en el monorepo jpl.

Licencia original conservada. El crédito del diseño y la implementación original es de Jeff Peiffer.

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
150
points
1
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

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

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

expressions, flutter, jpl_child_builder, jpl_json_class, jpl_json_dynamic_widget, jpl_json_theme, logging, meta, uuid

More

Packages that depend on jpl_json_dynamic_widget_plugin_expressions