Repository navigation
Conversation
Allow external configuration
|
This repository now uses |
|
Linked issue tracking the production impact (CanvasKit WebGL texture loss and solid black images during route transitions) that this PR resolves: #1061 |
rickdijk
left a comment
There was a problem hiding this comment.
Thanks for this. A few things that don't sit on a diff line:
cached_network_image/pubspec.yamlneeds a version bump (4.0.4 to 4.1.0, since this adds public API) and a matchingCHANGELOG.mdentry.- A small test that uses
ImageRenderMethodForWebthroughpackage:cached_network_image/cached_network_image.dartalone would stop this export from quietly regressing. - Neither README mentions
imageRenderMethodForWeb. Now that users can set it, a short note on the trade-off would help:HtmlImage(the default) keeps browser caching but can't send custom headers, andHttpGetsends headers but loses browser caching.README.mdandcached_network_image/README.mdare separate files, so both need it.
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_cache_manager/flutter_cache_manager.dart'; | ||
| export 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart' |
There was a problem hiding this comment.
ErrorListener has the same problem. It's the type of the public errorListener parameter and still isn't exported, so an app that wants to name the type has to depend on cached_network_image_platform_interface directly, which trips depend_on_referenced_packages. Could you export it alongside ImageRenderMethodForWeb?
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_cache_manager/flutter_cache_manager.dart'; | ||
| export 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart' |
There was a problem hiding this comment.
Could this go in lib/cached_network_image.dart instead? That file already re-exports CacheManagerLogLevel and DownloadProgress from flutter_cache_manager with show, so all the public re-exports would live in one place:
export 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart'
show ErrorListener, ImageRenderMethodForWeb;| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_cache_manager/flutter_cache_manager.dart'; | ||
| export 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart' | ||
| show ImageRenderMethodForWeb; |
There was a problem hiding this comment.
This branch comes from develop, which we no longer maintain, and it predates the move to material_ui: the context above still imports package:flutter/material.dart, while main imports package:material_ui/material_ui.dart. Could you rebase onto main? The "All projects build" check in the description was run against the old base.
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_cache_manager/flutter_cache_manager.dart'; | ||
| export 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart' | ||
| show ImageRenderMethodForWeb; |
There was a problem hiding this comment.
Minor: re-exporting the enum makes it part of this package's public API, so renaming or removing a value in the platform interface later would be a breaking change here as well. Fine to do, just something to keep in mind when the interface changes.
Allow external configuration
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
DX improvement
when attempting to configure the
imageRenderMethodForWebproperty ofCachedNetworkImageProvider, the required ImageRenderMethodForWeb enum is inaccessible.🆕 What is the new behavior (if this is a feature change)?
ImageRenderMethodForWeb enum is now publicly exported, allowing consumers to configure the
imageRenderMethodForWebproperty.💥 Does this PR introduce a breaking change?
no
🐛 Recommendations for testing
n/a
📝 Links to relevant issues/docs
#1003
🤔 Checklist before submitting