getAssetImageProvider static method
获取本地 AssetImage
assetFilePath
assets资源文件路径
Implementation
static ImageProvider getAssetImageProvider(String assetFilePath,
{String? package}) {
if (!assetFilePath.startsWith('assets')) {
assetFilePath = 'assets/$assetFilePath';
}
final AssetImage image = AssetImage(
assetFilePath,
package: package ?? BaseStrings.flutterPackageName,
);
return image;
}