Skip to content

fix[firebase_ml_vision]: Migrate to sound null safety #5490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/firebase_ml_vision/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.0
> Note: This release has breaking changes.

- **BREAKING** **FEAT**: Migrate to sound null-safety.

## 0.11.0

- This version is not null-safe but has been created to allow compatibility with other null-safe FlutterFire packages such as `firebase_core`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart';

import 'colors.dart';
import 'scanner_utils.dart';
Expand Down Expand Up @@ -283,17 +282,9 @@ class _MaterialBarcodeScannerState extends State<MaterialBarcodeScanner>
}

Future<void> _takePicture() async {
final Directory extDir = await getApplicationDocumentsDirectory();

final String dirPath = '${extDir.path}/Pictures/barcodePics';
await Directory(dirPath).create(recursive: true);

final String timestamp = DateTime.now().millisecondsSinceEpoch.toString();

final String filePath = '$dirPath/$timestamp.jpg';

XFile file;
try {
await _cameraController.takePicture(filePath);
file = await _cameraController.takePicture();
} on CameraException catch (e) {
print(e);
}
Expand All @@ -302,7 +293,7 @@ class _MaterialBarcodeScannerState extends State<MaterialBarcodeScanner>
_cameraController = null;

setState(() {
_barcodePictureFilePath = filePath;
_barcodePictureFilePath = file.path;
});
}

Expand Down Expand Up @@ -351,9 +342,7 @@ class _MaterialBarcodeScannerState extends State<MaterialBarcodeScanner>
padding: const EdgeInsets.all(16),
child: Text(
'1 result found',
// TODO(bmparr): Switch body2 -> bodyText1 once https://github.com/flutter/flutter/pull/48547 makes it to stable.
// ignore: deprecated_member_use
style: Theme.of(context).textTheme.body2,
style: Theme.of(context).textTheme.bodyText1,
),
),
),
Expand Down Expand Up @@ -381,16 +370,13 @@ class _MaterialBarcodeScannerState extends State<MaterialBarcodeScanner>
margin: const EdgeInsets.only(bottom: 4),
child: Text(
'SPAN Reader',
// TODO(bmparr): Switch body2 -> bodyText1 once https://github.com/flutter/flutter/pull/48547 makes it to stable.
// ignore: deprecated_member_use
style: Theme.of(context).textTheme.body2,
style:
Theme.of(context).textTheme.bodyText1,
),
),
Text(
'Vol. 2',
// TODO(bmparr): Switch body2 -> bodyText1 once https://github.com/flutter/flutter/pull/48547 makes it to stable.
// ignore: deprecated_member_use
style: Theme.of(context).textTheme.body2,
style: Theme.of(context).textTheme.bodyText1,
),
Expanded(
child: Column(
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_ml_vision/example/lib/picture_scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class _PictureScannerState extends State<PictureScanner> {
_imageSize = null;
});

final File pickedImage =
await ImagePicker.pickImage(source: ImageSource.gallery);
final PickedFile pickedImage =
await ImagePicker().getImage(source: ImageSource.gallery);
final File imageFile = File(pickedImage.path);

setState(() {
Expand Down
8 changes: 4 additions & 4 deletions packages/firebase_ml_vision/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ environment:
flutter: ">=1.10.0"

dependencies:
camera: ^0.5.6+1
cupertino_icons: ^0.1.2
camera: ^0.8.0
cupertino_icons: ^1.0.2
firebase_core:
path: ../../firebase_core/firebase_core
firebase_ml_vision:
path: ../
flutter:
sdk: flutter
image_picker: ^0.6.0
image_picker: ^0.7.3

dependency_overrides:
firebase_core:
Expand All @@ -26,7 +26,7 @@ dependency_overrides:
path: ../../firebase_core/firebase_core_web

dev_dependencies:
e2e: ^0.6.1
e2e: ^0.7.0
flutter_driver:
sdk: flutter
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_ml_vision/lib/firebase_ml_vision.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9


library firebase_ml_vision;

Expand Down
Loading