Skip to content
pubscout

camera

0.12.2, released 3 weeks ago by flutter.dev

Flutter plugin to preview, capture photos/video and stream camera images.

WASM-ready
$ flutter pub add camera
Source repository

What it does

Provides a widget for live camera preview, methods to take pictures and record video, and an image stream API. Works on Android, iOS and Web.

AI-written summary of version 0.12.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need direct access to device cameras for photos, video or real‑time image processing
  • You require a cross‑platform solution that supports Android, iOS and Web

Skip it when

  • You only need simple image picking without live preview
  • You prefer a higher‑level abstraction like barcode scanning only

Strengths

  • Full‑screen preview widget
  • Supports zero‑shutter‑lag and video stabilization
  • Image stream for custom processing
  • Works on three major platforms

Weaknesses

  • Requires native permission handling and lifecycle management
  • No built‑in UI for scanning or advanced effects
  • Plugin size adds native binaries

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
5

Add camera and microphone usage descriptions to iOS Info.plist; ensure Android minSdk 24; handle app lifecycle and permission errors manually.

import 'package:camera/camera.dart';
import 'package:flutter/material.dart';

late List<CameraDescription> _cameras;

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  _cameras = await availableCameras();
  runApp(const CameraApp());
}

class CameraApp extends StatefulWidget {
  const CameraApp({super.key});
  @override
  State<CameraApp> createState() => _CameraAppState();
}

class _CameraAppState extends State<CameraApp> {
  late CameraController _controller;
  @override
  void initState() {
    super.initState();
    _controller = CameraController(_cameras[0], ResolutionPreset.max);
    _controller.initialize().then((_) => setState(() {}));
  }
  @override
  void dispose() { _controller.dispose(); super.dispose(); }
  @override
  Widget build(BuildContext context) {
    if (!_controller.value.isInitialized) return const SizedBox();
    return MaterialApp(home: CameraPreview(_controller));
  }
}

Alternatives

Packages that do the same job and could replace camera.

  • mobile_scanner

    If you only need QR/barcode scanning with a simpler API and less lifecycle handling

Works with

Packages commonly used together with camera: ones it builds on, ones built on it, and its own family.