September 2019
Beginner
512 pages
12h 52m
English
Flutter does not communicate with the camera API directly, as this is a platform-level resource. The image_picker plugin, as its name suggests, helps with picking an image. It enables importing image files from the gallery and taking new pictures using the camera.
First, we add the dependency to the pubspec.yaml file and get it with the flutter packages get command:
dependencies: image_picker: ^0.5.0 # Image picker
We control image picking in the same place as the user enters their display name after login, in the final step of the Stepper widget. When the user presses the small avatar image, the camera opens to take a picture:
// login_page.dart// part of LoginScreenState class void _importImage() async ...
Read now
Unlock full access