image_picker | Flutter Package
Flutter plugin for selecting images from the Android and iOS image library, and taking new pictures with the camera.
pub.dev
$ flutter pub add image_picker
- 유저의 library에서 사진이나 비디오를 가져오게해줌
1. 비디오 가져오기
Future<void> _onPickVideoPressed() async {
final video = await ImagePicker().pickVideo(source : ImageSource.gallery);
//유저의 라이브러리에 대한 접글을 요청하는 곳
if(video == null) return;
//유저가 비디오를 선택하지 않았을 경우엔 null
}
1-1 pickVideo
- xFile을 제공하는 future
Future<XFile?> pickVideo({
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
})
'기초다지기 > Flutter&Dart' 카테고리의 다른 글
flutter Spacer class (0) | 2023.10.25 |
---|---|
flutter camara 패키지 AppLifecycleState 앱 상태 확인 (0) | 2023.10.04 |
flutter gallery_saver 사용하여 갤러리에 사진 저장하기 (1) | 2023.09.27 |
flutter Visibility_detector 패키지 (0) | 2023.09.25 |
Flutter AnimatedOpacity class (1) | 2023.09.25 |