jpl_json_dynamic_widget_plugin_js 2.3.0+3 copy "jpl_json_dynamic_widget_plugin_js: ^2.3.0+3" to clipboard
jpl_json_dynamic_widget_plugin_js: ^2.3.0+3 copied to clipboard

A plugin to the JSON Dynamic Widget to provide JS support to the widgets

example/lib/main.dart

import 'dart:convert';

import 'package:jpl_json_dynamic_widget/jpl_json_dynamic_widget.dart';
import 'package:jpl_json_dynamic_widget_plugin_js/jpl_json_dynamic_widget_plugin_js.dart';
import 'package:logging/logging.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  Logger.root.onRecord.listen((record) {
    debugPrint('${record.level.name}: ${record.time}: ${record.message}');
    if (record.error != null) {
      debugPrint('${record.error}');
    }
    if (record.stackTrace != null) {
      debugPrint('${record.stackTrace}');
    }
  });

  final navigatorKey = GlobalKey<NavigatorState>();

  final registry = JsonWidgetRegistry.instance;
  JsonJsPlugin.bind(registry);

  registry.navigatorKey = navigatorKey;

  final data = JsonWidgetData.fromDynamic(
    json.decode(await rootBundle.loadString('assets/pages/js.json')),
  );

  runApp(
    MaterialApp(
      debugShowCheckedModeBanner: false,
      home: JsWidgetPage(data: data),
      theme: ThemeData.light(),
    ),
  );
}

class JsWidgetPage extends StatelessWidget {
  const JsWidgetPage({super.key, required this.data});

  final JsonWidgetData data;

  @override
  Widget build(BuildContext context) => data.build(context: context);
}
0
likes
140
points
1
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A plugin to the JSON Dynamic Widget to provide JS support to the widgets

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, jpl_json_dynamic_widget, jsf

More

Packages that depend on jpl_json_dynamic_widget_plugin_js