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

outdated

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
0
pub points
80%
popularity

Publisher

verified publisherainkin.com

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta

More

Packages that depend on onmessage