diff --git a/lib/utils/ev_from_bytes.dart b/lib/utils/ev_from_bytes.dart index da81831..c7c7b63 100644 --- a/lib/utils/ev_from_bytes.dart +++ b/lib/utils/ev_from_bytes.dart @@ -1,7 +1,7 @@ import 'dart:math' as math; -import 'dart:typed_data'; import 'package:exif/exif.dart'; +import 'package:flutter/foundation.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; Future evFromImage(Uint8List bytes) async { @@ -10,7 +10,7 @@ Future evFromImage(Uint8List bytes) async { final apertureValueRatio = (tags["EXIF FNumber"]?.values as IfdRatios?)?.ratios.first; final speedValueRatio = (tags["EXIF ExposureTime"]?.values as IfdRatios?)?.ratios.first; if (iso == null || apertureValueRatio == null || speedValueRatio == null) { - throw 'Error parsing EXIF: ${tags.keys}'; + throw FlutterError('Error parsing EXIF: ${tags.keys}'); } final aperture = apertureValueRatio.numerator / apertureValueRatio.denominator; diff --git a/test/utils/ev_from_bytes_test.dart b/test/utils/ev_from_bytes_test.dart index f73a257..635bb3c 100644 --- a/test/utils/ev_from_bytes_test.dart +++ b/test/utils/ev_from_bytes_test.dart @@ -17,7 +17,7 @@ void main() { 'no EXIF', () { final bytes = File('assets/launcher_icon_dev_512.png').readAsBytesSync(); - expectLater(evFromImage(bytes), completion(null)); + expectLater(evFromImage(bytes), throwsFlutterError); }, ); });