Line data Source code
1 : import 'dart:io';
2 :
3 : import 'package:flutter_chrome_cast/_remote_media_client/remote_media_client_platform.dart';
4 :
5 : import 'android_remote_media_client_method_channel.dart';
6 : import 'ios_remote_media_client_method_channel.dart';
7 :
8 : /// Main entry point for Google Cast remote media client functionality.
9 : ///
10 : /// This class provides a platform-agnostic interface for controlling media
11 : /// playback on Google Cast devices. It automatically selects the appropriate
12 : /// platform-specific implementation based on the current operating system.
13 : class GoogleCastRemoteMediaClient {
14 : /// Private constructor to enforce singleton pattern.
15 0 : GoogleCastRemoteMediaClient._();
16 :
17 0 : static final GoogleCastRemoteMediaClientPlatformInterface _instance =
18 0 : Platform.isAndroid
19 0 : ? GoogleCastRemoteMediaClientAndroidMethodChannel()
20 0 : : GoogleCastRemoteMediaClientIOSMethodChannel();
21 :
22 : /// Gets the singleton instance of the remote media client.
23 : ///
24 : /// Returns the appropriate platform-specific implementation
25 : /// (Android or iOS) based on the current platform.
26 0 : static GoogleCastRemoteMediaClientPlatformInterface get instance => _instance;
27 : }
|