Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated webOnlyInstantiateImageCodecFromUrl to createImageCodecFromUrl from dart:ui_web #939

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 4 additions & 4 deletions cached_network_image_web/lib/cached_network_image_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ 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;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

/// ImageLoader class to load images on the web platform.
Expand Down Expand Up @@ -154,8 +155,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 +165,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
Loading