Skip to content

Commit 568e3cb

Browse files
committed
Remove load functional
1 parent 2ab9c86 commit 568e3cb

20 files changed

+305
-269
lines changed

cached_network_image/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Specify types
55
* Add error to ErrorListener
66
* Update example
7-
* Use `loadImage` instead `loadBuffer` and `load`
7+
* Use `loadImage` instead `loadBuffer`
8+
* Remove [`load`](https://github.com/flutter/flutter/pull/132679)
89

910
## [3.2.3] - 2022-11-25
1011
* Correctly dispose image stream handler
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '11.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
target 'RunnerTests' do
36+
inherit! :search_paths
37+
end
38+
end
39+
40+
post_install do |installer|
41+
installer.pods_project.targets.each do |target|
42+
flutter_additional_ios_build_settings(target)
43+
end
44+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
platform :osx, '10.14'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
'Profile' => :release,
9+
'Release' => :release,
10+
}
11+
12+
def flutter_root
13+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14+
unless File.exist?(generated_xcode_build_settings_path)
15+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16+
end
17+
18+
File.foreach(generated_xcode_build_settings_path) do |line|
19+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
20+
return matches[1].strip if matches
21+
end
22+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23+
end
24+
25+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26+
27+
flutter_macos_podfile_setup
28+
29+
target 'Runner' do
30+
use_frameworks!
31+
use_modular_headers!
32+
33+
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34+
target 'RunnerTests' do
35+
inherit! :search_paths
36+
end
37+
end
38+
39+
post_install do |installer|
40+
installer.pods_project.targets.each do |target|
41+
flutter_additional_macos_build_settings(target)
42+
end
43+
end

cached_network_image/lib/src/image_provider/_image_loader.dart

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,11 @@ import 'package:cached_network_image_platform_interface/cached_network_image_pla
77
import 'package:cached_network_image_platform_interface'
88
'/cached_network_image_platform_interface.dart' as platform
99
show ImageLoader;
10-
import 'package:cached_network_image_platform_interface'
11-
'/cached_network_image_platform_interface.dart'
12-
show ImageRenderMethodForWeb;
1310
import 'package:flutter/material.dart';
1411
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
1512

1613
/// ImageLoader class to load images on IO platforms.
1714
class ImageLoader implements platform.ImageLoader {
18-
@Deprecated('Use loadImageAsync instead')
19-
@override
20-
Stream<ui.Codec> loadAsync(
21-
String url,
22-
String? cacheKey,
23-
StreamController<ImageChunkEvent> chunkEvents,
24-
DecoderCallback decode,
25-
BaseCacheManager cacheManager,
26-
int? maxHeight,
27-
int? maxWidth,
28-
Map<String, String>? headers,
29-
ValueChanged<Object>? errorListener,
30-
ImageRenderMethodForWeb imageRenderMethodForWeb,
31-
VoidCallback evictImage,
32-
) {
33-
return _load(
34-
url,
35-
cacheKey,
36-
chunkEvents,
37-
decode,
38-
cacheManager,
39-
maxHeight,
40-
maxWidth,
41-
headers,
42-
errorListener,
43-
imageRenderMethodForWeb,
44-
evictImage,
45-
);
46-
}
47-
4815
@Deprecated('Use loadImageAsync instead')
4916
@override
5017
Stream<ui.Codec> loadBufferAsync(
@@ -173,9 +140,8 @@ class ImageLoader implements platform.ImageLoader {
173140

174141
errorListener?.call(e);
175142
rethrow;
176-
} finally {
177-
await chunkEvents.close();
178143
}
144+
await chunkEvents.close();
179145
}
180146
}
181147

cached_network_image/lib/src/image_provider/cached_network_image_provider.dart

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,49 +67,6 @@ class CachedNetworkImageProvider
6767
return SynchronousFuture<CachedNetworkImageProvider>(this);
6868
}
6969

70-
@Deprecated('load is deprecated, use loadImage instead')
71-
@override
72-
ImageStreamCompleter load(
73-
CachedNetworkImageProvider key,
74-
DecoderCallback decode,
75-
) {
76-
final chunkEvents = StreamController<ImageChunkEvent>();
77-
return MultiImageStreamCompleter(
78-
codec: _loadAsync(key, chunkEvents, decode),
79-
chunkEvents: chunkEvents.stream,
80-
scale: key.scale,
81-
informationCollector: () sync* {
82-
yield DiagnosticsProperty<ImageProvider>(
83-
'Image provider: $this \n Image key: $key',
84-
this,
85-
style: DiagnosticsTreeStyle.errorProperty,
86-
);
87-
},
88-
);
89-
}
90-
91-
@Deprecated('_loadAsync is deprecated, use _loadImageAsync instead')
92-
Stream<ui.Codec> _loadAsync(
93-
CachedNetworkImageProvider key,
94-
StreamController<ImageChunkEvent> chunkEvents,
95-
DecoderCallback decode,
96-
) {
97-
assert(key == this);
98-
return ImageLoader().loadAsync(
99-
url,
100-
cacheKey,
101-
chunkEvents,
102-
decode,
103-
cacheManager ?? DefaultCacheManager(),
104-
maxHeight,
105-
maxWidth,
106-
headers,
107-
errorListener,
108-
imageRenderMethodForWeb,
109-
() => PaintingBinding.instance.imageCache.evict(key),
110-
);
111-
}
112-
11370
@Deprecated('loadBuffer is deprecated, use loadImage instead')
11471
@override
11572
ImageStreamCompleter loadBuffer(

cached_network_image/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ environment:
1212
flutter: '>=3.10.0'
1313

1414
dependencies:
15-
cached_network_image_platform_interface:
16-
cached_network_image_web:
15+
cached_network_image_platform_interface: ^2.0.1
16+
cached_network_image_web: ^1.0.3
1717
flutter:
1818
sdk: flutter
1919
flutter_cache_manager: ^3.3.1
@@ -24,4 +24,4 @@ dev_dependencies:
2424
flutter_lints: ^2.0.2
2525
flutter_test:
2626
sdk: flutter
27-
mocktail: ^0.3.0
27+
mocktail: ^1.0.0

0 commit comments

Comments
 (0)