json_dynamic_widget_plugin_js 2.0.2+11 copy "json_dynamic_widget_plugin_js: ^2.0.2+11" to clipboard
json_dynamic_widget_plugin_js: ^2.0.2+11 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:json_dynamic_widget/json_dynamic_widget.dart';
import 'package:json_dynamic_widget_plugin_js/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({
    Key? key,
    required this.data,
  }) : super(key: key);

  final JsonWidgetData data;

  @override
  Widget build(BuildContext context) => data.build(context: context);
}
0
likes
130
pub points
38%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

child_builder, flutter, flutter_js, js, json_class, json_dynamic_widget, json_theme, logging, meta, uuid

More

Packages that depend on json_dynamic_widget_plugin_js