diff --git a/CHANGELOG.md b/CHANGELOG.md index a775ad31..725b152b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 3.2.1 +- Add conditional imports to prevent importing `dart:io` on Web targets + ## 3.2.0 - Apply Blend mode at layer level diff --git a/example/pubspec.lock b/example/pubspec.lock index 3e9611d3..acb850a1 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -169,7 +169,7 @@ packages: path: ".." relative: true source: path - version: "3.2.0" + version: "3.2.1" matcher: dependency: transitive description: diff --git a/lib/src/lottie.dart b/lib/src/lottie.dart index 2a9e9035..8aad7c0b 100644 --- a/lib/src/lottie.dart +++ b/lib/src/lottie.dart @@ -1,4 +1,3 @@ -import 'dart:io' as io; import 'dart:typed_data'; import 'package:flutter/widgets.dart'; import 'package:http/http.dart' as http; @@ -97,7 +96,7 @@ class Lottie extends StatefulWidget { /// Creates a widget that displays an [LottieComposition] obtained from a [File]. static LottieBuilder file( - io.File file, { + Object file, { Animation? controller, FrameRate? frameRate, bool? animate, diff --git a/lib/src/lottie_builder.dart b/lib/src/lottie_builder.dart index 6bf72aa6..de3210b6 100644 --- a/lib/src/lottie_builder.dart +++ b/lib/src/lottie_builder.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:io' as io; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:http/http.dart' as http; @@ -111,7 +110,7 @@ class LottieBuilder extends StatefulWidget { /// `android.permission.READ_EXTERNAL_STORAGE` permission. /// LottieBuilder.file( - io.File file, { + Object file, { this.controller, this.frameRate, this.animate, diff --git a/lib/src/providers/file_provider_io.dart b/lib/src/providers/file_provider_io.dart index d17ed5f8..285358a6 100644 --- a/lib/src/providers/file_provider_io.dart +++ b/lib/src/providers/file_provider_io.dart @@ -12,11 +12,12 @@ import 'lottie_provider.dart'; @immutable class FileLottie extends LottieProvider { FileLottie( - this.file, { + Object file, { super.imageProviderFactory, super.decoder, super.backgroundLoading, - }) : assert( + }) : file = file as io.File, + assert( !kIsWeb, 'Lottie.file is not supported on Flutter Web. ' 'Consider using either Lottie.asset or Lottie.network instead.', diff --git a/pubspec.lock b/pubspec.lock index ff2557c8..5abe182d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -351,4 +351,4 @@ packages: version: "3.1.2" sdks: dart: ">=3.5.0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + flutter: ">=3.24.0" diff --git a/pubspec.yaml b/pubspec.yaml index 36be82e2..e8707b53 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: lottie description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player. -version: 3.2.0 +version: 3.2.1 repository: https://github.com/xvrh/lottie-flutter funding: