| @@ -55,8 +55,8 @@ When a QR code is recognized, the text identified will be set in 'result' of typ | |||||
| ```dart | ```dart | ||||
| class _QRViewExampleState extends State<QRViewExample> { | class _QRViewExampleState extends State<QRViewExample> { | ||||
| final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); | final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); | ||||
| Barcode result; | |||||
| QRViewController controller; | |||||
| Barcode? result; | |||||
| QRViewController? controller; | |||||
| // In order to get hot reload to work we need to pause the camera if the platform | // In order to get hot reload to work we need to pause the camera if the platform | ||||
| // is android, or resume the camera if the platform is iOS. | // is android, or resume the camera if the platform is iOS. | ||||
| @@ -64,9 +64,9 @@ class _QRViewExampleState extends State<QRViewExample> { | |||||
| void reassemble() { | void reassemble() { | ||||
| super.reassemble(); | super.reassemble(); | ||||
| if (Platform.isAndroid) { | if (Platform.isAndroid) { | ||||
| controller.pauseCamera(); | |||||
| controller!.pauseCamera(); | |||||
| } else if (Platform.isIOS) { | } else if (Platform.isIOS) { | ||||
| controller.resumeCamera(); | |||||
| controller!.resumeCamera(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -87,7 +87,7 @@ class _QRViewExampleState extends State<QRViewExample> { | |||||
| child: Center( | child: Center( | ||||
| child: (result != null) | child: (result != null) | ||||
| ? Text( | ? Text( | ||||
| 'Barcode Type: ${describeEnum(result.format)} Data: ${result.code}') | |||||
| 'Barcode Type: ${describeEnum(result!.format)} Data: ${result!.code}') | |||||
| : Text('Scan a code'), | : Text('Scan a code'), | ||||
| ), | ), | ||||
| ) | ) | ||||
| @@ -123,6 +123,16 @@ In ```android/build.gradle``` change ```classpath 'com.android.tools.build:gradl | |||||
| In ```android/gradle/wrapper/gradle-wrapper.properties``` change ```distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip``` to ```distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip``` | In ```android/gradle/wrapper/gradle-wrapper.properties``` change ```distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip``` to ```distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip``` | ||||
| In ```android/app/build.gradle``` change | |||||
| ```defaultConfig{``` | |||||
| ```...``` | |||||
| ```minSdkVersion 16``` | |||||
| ```}``` to | |||||
| ```defaultConfig{``` | |||||
| ```...``` | |||||
| ```minSdkVersion 20``` | |||||
| ```}``` | |||||
| ### *Warning* | ### *Warning* | ||||
| If you are using Flutter Beta or Dev channel (1.25 or 1.26) you can get the following error: | If you are using Flutter Beta or Dev channel (1.25 or 1.26) you can get the following error: | ||||
| @@ -179,7 +189,7 @@ await controller.resumeCamera(); | |||||
| # SDK | # SDK | ||||
| Requires at least SDK 21 (Android 5.0). | |||||
| Requires at least SDK 20. | |||||
| Requires at least iOS 8. | Requires at least iOS 8. | ||||
| # TODOs | # TODOs | ||||