You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
A Flutter plugin for iOS, Android and Web allowing access to the device cameras.
@@ -59,33 +61,35 @@ For web integration details, see the
59
61
60
62
As of version [0.5.0](https://github.com/flutter/plugins/blob/master/packages/camera/CHANGELOG.md#050) of the camera plugin, lifecycle changes are no longer handled by the plugin. This means developers are now responsible to control camera resources when the lifecycle state is updated. Failure to do so might lead to unexpected behavior (for example as described in issue [#39109](https://github.com/flutter/flutter/issues/39109)). Handling lifecycle changes can be done by overriding the `didChangeAppLifecycleState` method like so:
@@ -100,7 +104,7 @@ class CameraApp extends StatefulWidget {
100
104
}
101
105
102
106
class _CameraAppState extends State<CameraApp> {
103
-
CameraController controller;
107
+
late CameraController controller;
104
108
105
109
@override
106
110
void initState() {
@@ -116,7 +120,7 @@ class _CameraAppState extends State<CameraApp> {
116
120
117
121
@override
118
122
void dispose() {
119
-
controller?.dispose();
123
+
controller.dispose();
120
124
super.dispose();
121
125
}
122
126
@@ -130,7 +134,6 @@ class _CameraAppState extends State<CameraApp> {
130
134
);
131
135
}
132
136
}
133
-
134
137
```
135
138
136
139
For a more elaborate usage example see [here](https://github.com/flutter/plugins/tree/main/packages/camera/camera/example).
0 commit comments