From abac02b49b577be2853d4d6da64c7127fea7b6c8 Mon Sep 17 00:00:00 2001 From: ptgms <62300763+ptgms@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:36:15 +0200 Subject: [PATCH 1/2] fix compatibility with latest 'stable' flutter build + bump min sdk to 3.3.0 --- example/image_classification_mobilenet/pubspec.yaml | 2 +- example/reinforcement_learning/pubspec.yaml | 2 +- example/style_transfer/pubspec.yaml | 2 +- example/super_resolution_esrgan/pubspec.yaml | 2 +- example/text_classification/pubspec.yaml | 2 +- lib/src/tensor.dart | 4 ++-- pubspec.yaml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example/image_classification_mobilenet/pubspec.yaml b/example/image_classification_mobilenet/pubspec.yaml index 468ce3f..9b2a9f2 100644 --- a/example/image_classification_mobilenet/pubspec.yaml +++ b/example/image_classification_mobilenet/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: camera: ^0.10.5+2 diff --git a/example/reinforcement_learning/pubspec.yaml b/example/reinforcement_learning/pubspec.yaml index 33caf5d..bb88513 100644 --- a/example/reinforcement_learning/pubspec.yaml +++ b/example/reinforcement_learning/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: flutter: diff --git a/example/style_transfer/pubspec.yaml b/example/style_transfer/pubspec.yaml index fca2d1b..3bebd0a 100644 --- a/example/style_transfer/pubspec.yaml +++ b/example/style_transfer/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: flutter: diff --git a/example/super_resolution_esrgan/pubspec.yaml b/example/super_resolution_esrgan/pubspec.yaml index dc5901d..7a6c6a6 100644 --- a/example/super_resolution_esrgan/pubspec.yaml +++ b/example/super_resolution_esrgan/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: flutter: diff --git a/example/text_classification/pubspec.yaml b/example/text_classification/pubspec.yaml index 4dd475d..c3ab61d 100644 --- a/example/text_classification/pubspec.yaml +++ b/example/text_classification/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: flutter: diff --git a/lib/src/tensor.dart b/lib/src/tensor.dart index 2283585..e34bc4d 100644 --- a/lib/src/tensor.dart +++ b/lib/src/tensor.dart @@ -55,8 +55,8 @@ class Tensor { /// Underlying data buffer as bytes. Uint8List get data { final data = cast(tfliteBinding.TfLiteTensorData(_tensor)); - return UnmodifiableUint8ListView( - data.asTypedList(tfliteBinding.TfLiteTensorByteSize(_tensor))); + return data.asTypedList(tfliteBinding.TfLiteTensorByteSize(_tensor)) + .asUnmodifiableView(); } /// Quantization Params associated with the model, [only Android] diff --git a/pubspec.yaml b/pubspec.yaml index 8c5a24f..b7c80fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,7 +20,7 @@ version: 0.10.3 homepage: https://github.com/tensorflow/flutter-tflite environment: - sdk: '>=2.18.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' flutter: '>=1.10.0' dependencies: From 898c8b5e292f07cf20125069768da58594b44bce Mon Sep 17 00:00:00 2001 From: ptgms <62300763+ptgms@users.noreply.github.com> Date: Wed, 31 Jul 2024 08:50:29 +0200 Subject: [PATCH 2/2] format files --- lib/src/tensor.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/tensor.dart b/lib/src/tensor.dart index e34bc4d..f2f5176 100644 --- a/lib/src/tensor.dart +++ b/lib/src/tensor.dart @@ -55,8 +55,9 @@ class Tensor { /// Underlying data buffer as bytes. Uint8List get data { final data = cast(tfliteBinding.TfLiteTensorData(_tensor)); - return data.asTypedList(tfliteBinding.TfLiteTensorByteSize(_tensor)) - .asUnmodifiableView(); + return data + .asTypedList(tfliteBinding.TfLiteTensorByteSize(_tensor)) + .asUnmodifiableView(); } /// Quantization Params associated with the model, [only Android]