Future initializeController() async {
debugPrint(“ Initializing DeepAR…”);
await requestPermissions();
try {
bool initialized = await deepArController.initialize(
androidLicenseKey:
licenseKey,
iosLicenseKey: "",
resolution: Resolution.low, // Try lowering resolution
);
if (!initialized) {
debugPrint("❌ DeepAR failed to initialize. License key missing?");
isInitialized.value = false;
return;
}
debugPrint("🔄 Forcing camera switch...");
await deepArController.flipCamera(); // Force camera to reset
await Future.delayed(const Duration(milliseconds: 500));
await deepArController.flipCamera();
debugPrint("✅ DeepAR initialized successfully!");
isInitialized.value = true;
} catch (e) {
debugPrint("❌ DeepAR Initialization Error: $e");
isInitialized.value = false;
}
}