g123k / flutter_torch_compat

A plugin to enable or disable the torch of a device that works both on Android (including Android 4.x) and iOS.
https://pub.dev/packages/torch_compat
Apache License 2.0
7 stars 22 forks source link

Not working on Android #1

Closed DavideBicego closed 4 years ago

DavideBicego commented 4 years ago

code: bool hasFlash = await TorchCompat.hasTorch;

error: E/flutter (17404): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method turnOn on channel g123k/torch_compat)

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Versione 10.0.18363.476], locale it-IT)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.5)
[√] VS Code, 64-bit edition (version 1.40.2)
[√] Connected device (1 available)

I didn't test it on iOS yet

DavideBicego commented 4 years ago

Actually neither TorchCompat.turnOn or tornOff works in Android

g123k commented 4 years ago
DavideBicego commented 4 years ago

I think that the problem is that I'm trying to toggle the flash with the camera open...

Anyway flutter clean has no effect, you example app works and the device is a Huawei/Honor JSN-L21.

g123k commented 4 years ago

Indeed, this project can not work if you have another camera session opened. Android doesn't allow to have multiple instances at the same type.

g123k commented 4 years ago

I close the issue, since it's not related to the plugin itself. Please open a new one, if necessary :)