Created
March 24, 2019 21:21
-
-
Save redbluenat/e7d9d7547a007fb2e1493a2b4d458ea7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
void initState() { | |
super.initState(); | |
setupCameras(); | |
} | |
Future<void> setupCameras() async { | |
try { | |
cameras = await availableCameras(); | |
controller = new CameraController(cameras[0], ResolutionPreset.medium); | |
await controller.initialize(); | |
} on CameraException catch (_) { | |
setState(() { | |
isReady = false; | |
}); | |
} | |
setState(() { | |
isReady = true; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment