Line data Source code
1 : import 'dart:io';
2 :
3 : import 'package:flutter_chrome_cast/_google_cast_context/android_google_cast_context_method_channel.dart';
4 : import 'package:flutter_chrome_cast/_google_cast_context/google_cast_context_platform_interface.dart';
5 :
6 : import 'ios_google_cast_context_method_channel.dart';
7 :
8 : /// Main entry point for Google Cast context functionality.
9 : ///
10 : /// This class provides a platform-agnostic interface for initializing and
11 : /// managing the Google Cast context. It automatically selects the appropriate
12 : /// platform-specific implementation based on the current operating system.
13 : class GoogleCastContext {
14 3 : static final GoogleCastContextPlatformInterface _instance = Platform.isAndroid
15 0 : ? GoogleCastContextAndroidMethodChannel()
16 1 : : FlutterIOSGoogleCastContextMethodChannel();
17 :
18 : /// Gets the singleton instance of the Google Cast context.
19 : ///
20 : /// Returns the appropriate platform-specific implementation
21 : /// (Android or iOS) based on the current platform.
22 3 : static GoogleCastContextPlatformInterface instance = _instance;
23 :
24 : /// Private constructor to enforce singleton pattern.
25 0 : GoogleCastContext._();
26 : }
|