getAssetImageProvider static method

ImageProvider<Object> getAssetImageProvider(
  1. String assetFilePath, {
  2. String? package,
})

获取本地 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;
}