Skip to content

Commit 7e4d1d3

Browse files
authored
Add conditional imports to prevent importing dart:io on Web targets (#387)
1 parent 56a69f5 commit 7e4d1d3

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.2.1
2+
- Add conditional imports to prevent importing `dart:io` on Web targets
3+
14
## 3.2.0
25
- Apply Blend mode at layer level
36

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ packages:
169169
path: ".."
170170
relative: true
171171
source: path
172-
version: "3.2.0"
172+
version: "3.2.1"
173173
matcher:
174174
dependency: transitive
175175
description:

lib/src/lottie.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'dart:io' as io;
21
import 'dart:typed_data';
32
import 'package:flutter/widgets.dart';
43
import 'package:http/http.dart' as http;
@@ -97,7 +96,7 @@ class Lottie extends StatefulWidget {
9796

9897
/// Creates a widget that displays an [LottieComposition] obtained from a [File].
9998
static LottieBuilder file(
100-
io.File file, {
99+
Object file, {
101100
Animation<double>? controller,
102101
FrameRate? frameRate,
103102
bool? animate,

lib/src/lottie_builder.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
import 'dart:io' as io;
32
import 'package:flutter/foundation.dart';
43
import 'package:flutter/widgets.dart';
54
import 'package:http/http.dart' as http;
@@ -111,7 +110,7 @@ class LottieBuilder extends StatefulWidget {
111110
/// `android.permission.READ_EXTERNAL_STORAGE` permission.
112111
///
113112
LottieBuilder.file(
114-
io.File file, {
113+
Object file, {
115114
this.controller,
116115
this.frameRate,
117116
this.animate,

lib/src/providers/file_provider_io.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ import 'lottie_provider.dart';
1212
@immutable
1313
class FileLottie extends LottieProvider {
1414
FileLottie(
15-
this.file, {
15+
Object file, {
1616
super.imageProviderFactory,
1717
super.decoder,
1818
super.backgroundLoading,
19-
}) : assert(
19+
}) : file = file as io.File,
20+
assert(
2021
!kIsWeb,
2122
'Lottie.file is not supported on Flutter Web. '
2223
'Consider using either Lottie.asset or Lottie.network instead.',

pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,4 @@ packages:
351351
version: "3.1.2"
352352
sdks:
353353
dart: ">=3.5.0 <4.0.0"
354-
flutter: ">=3.18.0-18.0.pre.54"
354+
flutter: ">=3.24.0"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: lottie
22
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
3-
version: 3.2.0
3+
version: 3.2.1
44
repository: https://github.com/xvrh/lottie-flutter
55

66
funding:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy