commentImageParser static method
This method is used to parse the image from the URL or the path.
CommentBox.commentImageParser(imageURLorPath: 'url_or_path_to_image')
Implementation
static ImageProvider commentImageParser({imageURLorPath}) {
try {
//check if imageURLorPath
if (imageURLorPath is String) {
if (imageURLorPath.startsWith('http')) {
return NetworkImage(imageURLorPath);
} else {
return AssetImage(imageURLorPath);
}
} else {
return imageURLorPath;
}
} catch (e) {
//throw error
throw Exception('Error parsing image: $e');
}
}