dsbridge_flutter 1.0.2 copy "dsbridge_flutter: ^1.0.2" to clipboard
dsbridge_flutter: ^1.0.2 copied to clipboard

A modern cross-platform JavaScript bridge, through which you can invoke each other's functions synchronously or asynchronously between JavaScript and Dart.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'js_call_dart_page.dart';
import 'dart_call_js_page.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const HomePage(),
      theme: ThemeData(
        useMaterial3: true,
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: const Text('DSBridge for Flutter'),
      ),
      body: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 20),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            FilledButton(
              onPressed: () {
                Navigator.push(
                    context,
                    MaterialPageRoute(
                        builder: (context) => const DartCallJsPage()));
              },
              child: const Text('Dart call JavaScript'),
            ),
            FilledButton(
              onPressed: () {
                Navigator.push(
                    context,
                    MaterialPageRoute(
                        builder: (context) => const JsCallDartPage()));
              },
              child: const Text('JavaScript call Dart'),
            ),
          ],
        ),
      ),
    );
  }
}
22
likes
0
points
198
downloads

Publisher

unverified uploader

Weekly Downloads

A modern cross-platform JavaScript bridge, through which you can invoke each other's functions synchronously or asynchronously between JavaScript and Dart.

Repository (GitHub)
View/report issues

Topics

#jsbridge #javascript #webview #html

License

unknown (license)

Dependencies

flutter, webview_flutter, webview_flutter_platform_interface

More

Packages that depend on dsbridge_flutter