rx_method_channel 0.0.1 copy "rx_method_channel: ^0.0.1" to clipboard
rx_method_channel: ^0.0.1 copied to clipboard

Reactive (Rx) wrapper for method channel.

rx_method_channel #

Reactive (Rx) wrapper for method channel in Flutter.

How to Use? #

  • Add this dependency to pubspec.yaml
  • Make method channel using RxMethodChannel
import 'package:rx_method_channel/rx_method_channel.dart';

void main() async {
  final channel = RxMethodChannel(channelName: "channelName");

  // Observable
  final observableSubsciption = channel.executeObservable(
    methodName: "methodName",
    arguments: {},
  ).listen((event) { 

  });
  observableSubsciption.cancel();

  // Completable
  final completableOperation =
      channel.executeCompletable(methodName: "methodName");
  await completableOperation.valueOrCancellation().whenComplete(() {
    print("Completed");
  });


  // Single
  final singleOperation = channel.executeSingle(
    methodName: "methodName",
    arguments: {
      "arg": "someArg",
    },
  );

  final value = await singleOperation.valueOrCancellation();
  print(value);
}

0
likes
130
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

Reactive (Rx) wrapper for method channel.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

async, flutter, plugin_platform_interface, rxdart

More

Packages that depend on rx_method_channel