Line data Source code
1 : import 'package:flutter/services.dart';
2 : import 'package:flutter_chrome_cast/entities/cast_options.dart';
3 :
4 : import 'google_cast_context_platform_interface.dart';
5 :
6 : /// Android-specific implementation of Google Cast context functionality.
7 : ///
8 : /// This class provides the Android platform implementation for initializing
9 : /// and managing the Google Cast context using method channels.
10 : class GoogleCastContextAndroidMethodChannel
11 : implements GoogleCastContextPlatformInterface {
12 : final _channel = const MethodChannel('com.felnanuke.google_cast.context');
13 :
14 1 : @override
15 : Future<bool> setSharedInstanceWithOptions(
16 : GoogleCastOptions castOptions) async {
17 : try {
18 : final result =
19 3 : await _channel.invokeMethod('setSharedInstance', castOptions.toMap());
20 1 : return result == true;
21 : } catch (e) {
22 : rethrow;
23 : }
24 : }
25 : }
|