prepareMessage method
Prepares the message to be used for loading the SVG asset. Returns the ByteData of the loaded asset.
Implementation
@override
Future<ByteData?> prepareMessage(BuildContext? context) async {
try {
return await _resolveBundle(context).load(
packageName == null ? assetName : 'packages/$packageName/$assetName',
);
} catch (e) {
// Handle loading error, log it, or rethrow it
if (kDebugMode) {
print('Error loading asset: $e');
}
return null;
}
}