Skip to content

Commit

Permalink
Replace deprecated webOnlyInstantiateImageCodecFromUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
Carapacik committed Apr 12, 2024
1 parent 08599c6 commit 568e7c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions cached_network_image_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.2.0] -
* Replace deprecated `webOnlyInstantiateImageCodecFromUrl` to `createImageCodecFromUrl` from `dart:ui_web`

## [1.1.1] - 2023-12-31
* Removed errorListener from ImageLoader interface

Expand Down
9 changes: 4 additions & 5 deletions cached_network_image_web/lib/cached_network_image_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ library cached_network_image_web;
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'dart:ui_web' as ui_web;

import 'package:cached_network_image_platform_interface'
'/cached_network_image_platform_interface.dart' as platform
show ImageLoader, ImageRenderMethodForWeb;
'/cached_network_image_platform_interface.dart' as platform show ImageLoader, ImageRenderMethodForWeb;
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

Expand Down Expand Up @@ -154,8 +154,7 @@ class ImageLoader implements platform.ImageLoader {
StreamController<ImageChunkEvent> chunkEvents,
) {
final resolved = Uri.base.resolve(url);
// ignore: undefined_function
return ui.webOnlyInstantiateImageCodecFromUrl(
return ui_web.createImageCodecFromUrl(
resolved,
chunkCallback: (int bytes, int total) {
chunkEvents.add(
Expand All @@ -165,7 +164,7 @@ class ImageLoader implements platform.ImageLoader {
),
);
},
) as Future<ui.Codec>;
);
}
}

Expand Down
6 changes: 3 additions & 3 deletions cached_network_image_web/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: cached_network_image_web
description: Web implementation of CachedNetworkImage
version: 1.1.1
version: 1.2.0
homepage: https://github.com/Baseflow/flutter_cached_network_image

environment:
sdk: ^3.0.0
sdk: '>=3.0.0 <4.0.0'
flutter: '>=3.10.0'

dependencies:
Expand All @@ -15,6 +15,6 @@ dependencies:

dev_dependencies:
file: '>=6.1.4 <8.0.0'
flutter_lints: ^2.0.3
flutter_lints: '>=2.0.3 <4.0.0'
flutter_test:
sdk: flutter

0 comments on commit 568e7c5

Please sign in to comment.