-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#53586Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listplatform-androidAndroid applications specificallyAndroid applications specificallyr: solvedIssue is closed as solvedIssue is closed as solvedteam-engineOwned by Engine teamOwned by Engine team
Description
What package does this bug report belong to?
camera
What target platforms are you seeing this bug on?
Android
Have you already upgraded your packages?
Yes
Dependency versions
pubspec.lock
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
camera:
dependency: "direct main"
description:
name: camera
sha256: dfa8fc5a1adaeb95e7a54d86a5bd56f4bb0e035515354c8ac6d262e35cec2ec8
url: "https://pub.dev"
source: hosted
version: "0.10.6"
camera_android:
dependency: transitive
description:
name: camera_android
sha256: ca42d500c1b58c1ab90ef819909b4de769bcb388a643b692a639c36954a3dc78
url: "https://pub.dev"
source: hosted
version: "0.10.9+5"
camera_avfoundation:
dependency: transitive
description:
name: camera_avfoundation
sha256: "7d021e8cd30d9b71b8b92b4ad669e80af432d722d18d6aac338572754a786c15"
url: "https://pub.dev"
source: hosted
version: "0.9.16"
camera_platform_interface:
dependency: transitive
description:
name: camera_platform_interface
sha256: a250314a48ea337b35909a4c9d5416a208d736dcb01d0b02c6af122be66660b0
url: "https://pub.dev"
source: hosted
version: "2.7.4"
camera_web:
dependency: transitive
description:
name: camera_web
sha256: "9e9aba2fbab77ce2472924196ff8ac4dd8f9126c4f9a3096171cd1d870d6b26c"
url: "https://pub.dev"
source: hosted
version: "0.3.3"
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
cross_file:
dependency: transitive
description:
name: cross_file
sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32"
url: "https://pub.dev"
source: hosted
version: "0.3.4+1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://pub.dev"
source: hosted
version: "1.0.8"
fake_async:
dependency: transitive
description:
name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e
url: "https://pub.dev"
source: hosted
version: "2.0.20"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
name: lints
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "3.0.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.12.0"
multi_image_capture:
dependency: "direct main"
description:
name: multi_image_capture
sha256: ec93a345792ebcf6af6f4f50cea6395dccebc67a2ca05b314eace135f3c1ec93
url: "https://pub.dev"
source: hosted
version: "1.0.2"
path:
dependency: "direct main"
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
path_provider:
dependency: "direct main"
description:
name: path_provider
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
url: "https://pub.dev"
source: hosted
version: "2.1.3"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a
url: "https://pub.dev"
source: hosted
version: "2.2.6"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
url: "https://pub.dev"
source: hosted
version: "2.4.0"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.dev"
source: hosted
version: "2.2.1"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
platform:
dependency: transitive
description:
name: platform
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.2"
stream_transform:
dependency: transitive
description:
name: stream_transform
sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
win32:
dependency: transitive
description:
name: win32
sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
url: "https://pub.dev"
source: hosted
version: "5.5.1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
url: "https://pub.dev"
source: hosted
version: "1.0.4"
sdks:
dart: ">=3.4.1 <4.0.0"
flutter: ">=3.22.0"
Steps to reproduce
I was following this guide: https://docs.flutter.dev/cookbook/plugins/picture-using-camera
I changed minSdk to 21 as mentioned.
Error on Emulator: Pixel 7a API 31
Expected results
Expected Results:
Emulator: Pixel 3a API 34
W/Camera ( 8156): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
D/EGL_emulation( 8156): app_time_stats: avg=103.60ms min=15.34ms max=545.18ms count=10
I/Camera ( 8156): startPreview
D/EGL_emulation( 8156): app_time_stats: avg=31.33ms min=8.93ms max=63.82ms count=30
I/Camera ( 8156): CameraCaptureSession onConfigured
I/Camera ( 8156): Updating builder settings
D/Camera ( 8156): Updating builder with feature: ExposureLockFeature
D/Camera ( 8156): Updating builder with feature: ExposurePointFeature
D/Camera ( 8156): Updating builder with feature: ZoomLevelFeature
D/Camera ( 8156): Updating builder with feature: AutoFocusFeature
D/Camera ( 8156): Updating builder with feature: NoiseReductionFeature
I/Camera ( 8156): updateNoiseReduction | currentSetting: fast
D/Camera ( 8156): Updating builder with feature: FocusPointFeature
D/Camera ( 8156): Updating builder with feature: ResolutionFeature
D/Camera ( 8156): Updating builder with feature: SensorOrientationFeature
D/Camera ( 8156): Updating builder with feature: FlashFeature
D/Camera ( 8156): Updating builder with feature: ExposureOffsetFeature
D/Camera ( 8156): Updating builder with feature: FpsRangeFeature
I/Camera ( 8156): refreshPreviewCaptureSession
D/EGL_emulation( 8156): app_time_stats: avg=208.43ms min=11.06ms max=569.48ms count=5
D/EGL_emulation( 8156): app_time_stats: avg=35.69ms min=13.88ms max=111.84ms count=25
D/EGL_emulation( 8156): app_time_stats: avg=34.70ms min=14.97ms max=58.31ms count=28
I/Camera ( 8156): runPictureAutoFocus
I/Camera ( 8156): lockAutoFocus
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2
D/EGL_emulation( 8156): app_time_stats: avg=42.14ms min=15.22ms max=178.49ms count=25
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 5 | aeState: 2
I/Camera ( 8156): captureStillPicture
D/Camera ( 8156): Updating builder with feature: ExposureLockFeature
D/Camera ( 8156): Updating builder with feature: ExposurePointFeature
D/Camera ( 8156): Updating builder with feature: ZoomLevelFeature
D/Camera ( 8156): Updating builder with feature: AutoFocusFeature
D/Camera ( 8156): Updating builder with feature: NoiseReductionFeature
I/Camera ( 8156): updateNoiseReduction | currentSetting: fast
D/Camera ( 8156): Updating builder with feature: FocusPointFeature
D/Camera ( 8156): Updating builder with feature: ResolutionFeature
D/Camera ( 8156): Updating builder with feature: SensorOrientationFeature
D/Camera ( 8156): Updating builder with feature: FlashFeature
D/Camera ( 8156): Updating builder with feature: ExposureOffsetFeature
D/Camera ( 8156): Updating builder with feature: FpsRangeFeature
I/Camera ( 8156): sending capture request
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
I/Camera ( 8156): unlockAutoFocus
I/Camera ( 8156): refreshPreviewCaptureSession
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
D/CameraCaptureCallback( 8156): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 2
I/Camera ( 8156): onImageAvailable
Actual results
It works on API34 but doesn't in API31. The app I'm building targets from API29 onward.
Error I got:
Emulator: Pixel 7a API 31
I/CameraManagerGlobal( 3629): Connecting to camera service
W/Camera ( 3629): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
I/Camera ( 3629): startPreview
I/Camera ( 3629): CameraCaptureSession onConfigured
I/Camera ( 3629): Updating builder settings
D/Camera ( 3629): Updating builder with feature: ExposureLockFeature
D/Camera ( 3629): Updating builder with feature: ExposurePointFeature
D/Camera ( 3629): Updating builder with feature: ZoomLevelFeature
D/Camera ( 3629): Updating builder with feature: AutoFocusFeature
D/Camera ( 3629): Updating builder with feature: NoiseReductionFeature
I/Camera ( 3629): updateNoiseReduction | currentSetting: fast
D/Camera ( 3629): Updating builder with feature: FocusPointFeature
D/Camera ( 3629): Updating builder with feature: ResolutionFeature
D/Camera ( 3629): Updating builder with feature: SensorOrientationFeature
D/Camera ( 3629): Updating builder with feature: FlashFeature
D/Camera ( 3629): Updating builder with feature: ExposureOffsetFeature
D/Camera ( 3629): Updating builder with feature: FpsRangeFeature
I/Camera ( 3629): refreshPreviewCaptureSession
W/ImageReaderSurfaceProducer( 3629): ImageTextureEntry can't wait on the fence on Android < 33
D/EGL_emulation( 3629): app_time_stats: avg=218.84ms min=10.24ms max=1784.16ms count=11
D/EGL_emulation( 3629): app_time_stats: avg=182.34ms min=15.25ms max=325.74ms count=6
D/EGL_emulation( 3629): app_time_stats: avg=202.74ms min=33.12ms max=334.96ms count=6
D/EGL_emulation( 3629): app_time_stats: avg=191.33ms min=18.71ms max=326.59ms count=6
D/EGL_emulation( 3629): app_time_stats: avg=148.94ms min=14.81ms max=298.36ms count=7
D/EGL_emulation( 3629): app_time_stats: avg=276.47ms min=125.66ms max=516.41ms count=4
I/Camera ( 3629): runPrecaptureSequence
I/Camera ( 3629): refreshPreviewCaptureSession
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 0 | aeState: 2
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 0 | aeState: 2
I/Camera ( 3629): captureStillPicture
D/Camera ( 3629): Updating builder with feature: ExposureLockFeature
D/Camera ( 3629): Updating builder with feature: ExposurePointFeature
D/Camera ( 3629): Updating builder with feature: ZoomLevelFeature
D/Camera ( 3629): Updating builder with feature: AutoFocusFeature
D/Camera ( 3629): Updating builder with feature: NoiseReductionFeature
I/Camera ( 3629): updateNoiseReduction | currentSetting: fast
D/Camera ( 3629): Updating builder with feature: FocusPointFeature
D/Camera ( 3629): Updating builder with feature: ResolutionFeature
D/Camera ( 3629): Updating builder with feature: SensorOrientationFeature
D/Camera ( 3629): Updating builder with feature: FlashFeature
D/Camera ( 3629): Updating builder with feature: ExposureOffsetFeature
D/Camera ( 3629): Updating builder with feature: FpsRangeFeature
I/Camera ( 3629): sending capture request
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
I/Camera ( 3629): unlockAutoFocus
I/Camera ( 3629): refreshPreviewCaptureSession
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/EGL_emulation( 3629): app_time_stats: avg=189.53ms min=101.74ms max=313.10ms count=5
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback( 3629): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
I/Camera ( 3629): open | onError
I/Camera ( 3629): close
I/Camera ( 3629): open | onClosed
Code sample
Code sample
import 'dart:async';
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
Future<void> main() async {
// Ensure that plugin services are initialized so that `availableCameras()`
// can be called before `runApp()`
WidgetsFlutterBinding.ensureInitialized();
// Obtain a list of the available cameras on the device.
final cameras = await availableCameras();
// Get a specific camera from the list of available cameras.
final firstCamera = cameras.first;
runApp(
MaterialApp(
theme: ThemeData.dark(),
home: TakePictureScreen(
// Pass the appropriate camera to the TakePictureScreen widget.
camera: firstCamera,
),
),
);
}
// A screen that allows users to take a picture using a given camera.
class TakePictureScreen extends StatefulWidget {
const TakePictureScreen({
super.key,
required this.camera,
});
final CameraDescription camera;
@override
TakePictureScreenState createState() => TakePictureScreenState();
}
class TakePictureScreenState extends State<TakePictureScreen> {
late CameraController _controller;
late Future<void> _initializeControllerFuture;
@override
void initState() {
super.initState();
// To display the current output from the Camera,
// create a CameraController.
_controller = CameraController(
// Get a specific camera from the list of available cameras.
widget.camera,
// Define the resolution to use.
ResolutionPreset.medium,
);
// Next, initialize the controller. This returns a Future.
_initializeControllerFuture = _controller.initialize();
}
@override
void dispose() {
// Dispose of the controller when the widget is disposed.
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Take a picture')),
// You must wait until the controller is initialized before displaying the
// camera preview. Use a FutureBuilder to display a loading spinner until the
// controller has finished initializing.
body: FutureBuilder<void>(
future: _initializeControllerFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
// If the Future is complete, display the preview.
return CameraPreview(_controller);
} else {
// Otherwise, display a loading indicator.
return const Center(child: CircularProgressIndicator());
}
},
),
floatingActionButton: FloatingActionButton(
// Provide an onPressed callback.
onPressed: () async {
// Take the Picture in a try / catch block. If anything goes wrong,
// catch the error.
try {
// Ensure that the camera is initialized.
await _initializeControllerFuture;
// Attempt to take a picture and get the file `image`
// where it was saved.
final image = await _controller.takePicture();
if (!context.mounted) return;
// If the picture was taken, display it on a new screen.
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => DisplayPictureScreen(
// Pass the automatically generated path to
// the DisplayPictureScreen widget.
imagePath: image.path,
),
),
);
} catch (e) {
// If an error occurs, log the error to the console.
print(e);
}
},
child: const Icon(Icons.camera_alt),
),
);
}
}
// A widget that displays the picture taken by the user.
class DisplayPictureScreen extends StatelessWidget {
final String imagePath;
const DisplayPictureScreen({super.key, required this.imagePath});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Display the Picture')),
// The image is stored as a file on the device. Use the `Image.file`
// constructor with the given path to display the image.
body: Image.file(File(imagePath)),
);
}
}Screenshots or Videos
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.22.1, on Ubuntu 24.04 LTS 6.8.0-31-generic, locale en_US.UTF-8)
• Flutter version 3.22.1 on channel stable at /home/mohit-marfatia/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision a14f74ff3a (5 weeks ago), 2024-05-22 11:08:21 -0500
• Engine revision 55eae6864b
• Dart version 3.4.1
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /home/mohit-marfatia/Android/Sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /snap/android-studio/157/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✗] Linux toolchain - develop for Linux desktop
✗ clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
✗ CMake is required for Linux development.
It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
✗ ninja is required for Linux development.
It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
• pkg-config version 1.8.1
✗ GTK 3.0 development libraries are required for Linux development.
They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[✓] Android Studio (version 2023.3)
• Android Studio at /snap/android-studio/157
• Flutter plugin version 80.0.1
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
[✓] VS Code (version 1.90.0)
• VS Code at /usr/share/code
• Flutter extension version 3.90.0
[✓] VS Code (version 1.90.2)
• VS Code at /snap/code/current/usr/share/code
• Flutter extension version 3.90.0
[✓] Connected device (2 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)
• Linux (desktop) • linux • linux-x64 • Ubuntu 24.04 LTS 6.8.0-31-generic
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listplatform-androidAndroid applications specificallyAndroid applications specificallyr: solvedIssue is closed as solvedIssue is closed as solvedteam-engineOwned by Engine teamOwned by Engine team