getOnloadingImage method
Asynchronously loads an image from the specified path
.
Updates internal state and handles errors.
Implementation
Future<void> getOnloadingImage({
required final String path,
final String? key
}) async {
// Update key if provided
if(key != null) updateKey(key);
// Start loading indicator
startLoading();
// Attempt to load image and update state accordingly
return await _useCase
.getOnloadingImage(
path : path,
headers : _headers,
maxSize : _maxSize,
key : _key,
)
.then(_setData) // Set image data on success
.onError(_setError) // Handle errors
.whenComplete(() => stopLoading() ); // Stop loading indicator
}