camera _ Flutter package
camera _ Flutter package
camera 0.11.0+2
Published 3 months ago • flutter.dev Dart 3 compatible
Versions Scores
Publisher
flutter.dev
Repository (GitHub)
Support SDK 21+ iOS 12.0+ See camera_web
View/report issues
Contributing
Features
Topics
Display live camera preview in a widget.
#camera
Snapshots can be captured and saved to a file.
Record video. Documentation
Add access to the image stream from Dart.
API reference
Setup
License
BSD-3-Clause (license)
iOS
More
<key>NSCameraUsageDescription</key>
<string>your usage description here</string> Packages that depend on
<key>NSMicrophoneUsageDescription</key> camera
<string>your usage description here</string>
<string>your usage description here</string>
Android
minSdkVersion 21
Web integration
@override
void didChangeAppLifecycleState(AppLifecycleState sta
final CameraController? cameraController = controll
Example
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
@override
State<CameraApp> createState() => _CameraAppState()
}
@override
void initState() {
super.initState();
controller = CameraController(_cameras[0], Resolu
controller.initialize().then((_) {
if (!mounted) {
return;
}
setState(() {});
}).catchError((Object e) {
if (e is CameraException) {
switch (e.code) {
case 'CameraAccessDenied':
// Handle access errors here.
break;
default:
// Handle other errors here.
break;
}
}
});
}
@ id
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (!controller.value.isInitialized) {
return Container();
}
return MaterialApp(
home: CameraPreview(controller),
);
}
}
Dart language Report package Policy Terms API Terms Security Privacy Help