onmessage 0.2.0 copy "onmessage: ^0.2.0" to clipboard
onmessage: ^0.2.0 copied to clipboard

A stream wrapping JavaScript's `window.onmessage` that is safe to import even on platforms other than web.

example/main.dart

import 'package:flutter/material.dart';
import 'package:onmessage/onmessage.dart';

/// This app prints all messages it receives from other frames in web.
void main() {
  OnMessage.instance.stream.listen((MessageEvent event) {
    print(event);
  });

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(),
    );
  }
}
8
likes
160
points
350
downloads

Publisher

verified publisherainkin.com

Weekly Downloads

A stream wrapping JavaScript's `window.onmessage` that is safe to import even on platforms other than web.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT-0 (license)

Dependencies

meta

More

Packages that depend on onmessage