Table of Contents

json_dynamic_widget_plugin_js

Table of Contents

Live Example

Introduction

Plugin to the JSON Dynamic Widget to provide JS support by using JSF.

Due to current limitations in JSF, the result returned from JavaScript is always a string. At the moment, we perform a simple parsing in the plugin to recognize basic types such as int, double, and bool. If you only need to return a string, please change stringToDartType(result) to result in js_service.dart.

Using the Plugin

import 'package:json_dynamic_widget/json_dynamic_widget.dart';
import 'package:json_dynamic_widget_plugin_js/json_dynamic_widget_plugin_js.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 widget provided by the plugin
  JsonJsPlugin.bind(registry);

  // ...
}