Skip to content

Instantly share code, notes, and snippets.

@redbluenat
Created March 24, 2019 21:21
Show Gist options
  • Save redbluenat/e7d9d7547a007fb2e1493a2b4d458ea7 to your computer and use it in GitHub Desktop.
Save redbluenat/e7d9d7547a007fb2e1493a2b4d458ea7 to your computer and use it in GitHub Desktop.
@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