1234567891011121314151617181920212223242526272829303132 |
- import 'dart:async';
- import 'package:flutter/services.dart';
- class Broadcast {
- static const MethodChannel _channel =
- const MethodChannel('broadcast');
- static const EventChannel _eventChannel = EventChannel('broadcast_event');
- static Stream<dynamic> get eventStream {
- return _eventChannel.receiveBroadcastStream();
- }
- static Future<String> get platformVersion async {
- final String version = await _channel.invokeMethod('getPlatformVersion');
- return version;
- }
- static Future<bool> broadcast(String action, {Map args}) async {
- final bool result = await _channel.invokeMethod('broadcast', {'action': action, 'args': args});
- return result;
- }
- static Future<bool> isLocationEnabled() async {
- final bool result = await _channel.invokeMethod('isLocationEnabled');
- return result;
- }
- static Future<bool> openSetting() async {
- final bool result = await _channel.invokeMethod('openSetting');
- return result;
- }
- }
|