mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
30 lines
844 B
Dart
30 lines
844 B
Dart
import 'package:firebase_core/firebase_core.dart';
|
|
import 'package:lunasea/system/platform.dart';
|
|
|
|
// ignore: always_use_package_imports
|
|
import 'options.dart';
|
|
|
|
class LunaFirebase {
|
|
static bool get isSupported {
|
|
final platform = LunaPlatform();
|
|
if (platform.isMobile || platform.isMacOS || platform.isWeb) {
|
|
// Validate that the firebase config exists by trying to load it
|
|
try {
|
|
DefaultFirebaseOptions.currentPlatform;
|
|
return true;
|
|
// ignore: empty_catches
|
|
} catch (_) {}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// Initialize Firebase and configuration.
|
|
///
|
|
/// This must be called before anything accesses Firebase services, or an exception will be thrown.
|
|
Future<void> initialize() async {
|
|
await Firebase.initializeApp(
|
|
options: DefaultFirebaseOptions.currentPlatform,
|
|
);
|
|
}
|
|
}
|