From 991544499d1708722aa5a1cb4a60d5145d266914 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 8 Mar 2023 18:25:02 +0800 Subject: [PATCH] Fix missing package on AssetGenImage.provider() --- packages/core/lib/generators/assets_generator.dart | 3 ++- packages/core/test_resources/actual_data/assets.gen.dart | 2 +- .../core/test_resources/actual_data/assets_camel_case.gen.dart | 2 +- .../actual_data/assets_change_class_name.gen.dart | 2 +- .../actual_data/assets_flare_integrations.gen.dart | 2 +- .../test_resources/actual_data/assets_ignore_files.gen.dart | 2 +- .../actual_data/assets_lottie_integrations.gen.dart | 2 +- .../test_resources/actual_data/assets_no_integrations.gen.dart | 2 +- .../actual_data/assets_package_exclude_files.gen.dart | 2 +- .../actual_data/assets_package_parameter.gen.dart | 2 +- .../actual_data/assets_rive_integrations.gen.dart | 2 +- .../core/test_resources/actual_data/assets_snake_case.gen.dart | 2 +- .../actual_data/assets_svg_integrations.gen.dart | 2 +- .../actual_data/assets_unknown_mime_type.gen.dart | 2 +- 14 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/core/lib/generators/assets_generator.dart b/packages/core/lib/generators/assets_generator.dart index c23db8dc..f0000c28 100644 --- a/packages/core/lib/generators/assets_generator.dart +++ b/packages/core/lib/generators/assets_generator.dart @@ -505,6 +505,7 @@ class $className { String _assetGenImageClassDefinition(String packageName) { final packageParameter = packageName.isNotEmpty ? " = '$packageName'" : ''; + final package = packageName.isNotEmpty ? "'$packageName'" : null; final keyName = packageName.isEmpty ? '_assetName' @@ -570,7 +571,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: $package); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets.gen.dart b/packages/core/test_resources/actual_data/assets.gen.dart index ceaf2174..116ad7da 100644 --- a/packages/core/test_resources/actual_data/assets.gen.dart +++ b/packages/core/test_resources/actual_data/assets.gen.dart @@ -207,7 +207,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_camel_case.gen.dart b/packages/core/test_resources/actual_data/assets_camel_case.gen.dart index 65ed2d07..88d8c2bf 100644 --- a/packages/core/test_resources/actual_data/assets_camel_case.gen.dart +++ b/packages/core/test_resources/actual_data/assets_camel_case.gen.dart @@ -139,7 +139,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_change_class_name.gen.dart b/packages/core/test_resources/actual_data/assets_change_class_name.gen.dart index 8c46fc25..abac9e8d 100644 --- a/packages/core/test_resources/actual_data/assets_change_class_name.gen.dart +++ b/packages/core/test_resources/actual_data/assets_change_class_name.gen.dart @@ -98,7 +98,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart index bb1de62d..99a8cdba 100644 --- a/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart @@ -85,7 +85,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart b/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart index c90a80cd..8afd91e7 100644 --- a/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart +++ b/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart @@ -77,7 +77,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart index 60093888..650862ca 100644 --- a/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart @@ -85,7 +85,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_no_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_no_integrations.gen.dart index 14e4fd46..59d678ee 100644 --- a/packages/core/test_resources/actual_data/assets_no_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_no_integrations.gen.dart @@ -168,7 +168,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_package_exclude_files.gen.dart b/packages/core/test_resources/actual_data/assets_package_exclude_files.gen.dart index 3885f460..95582ce1 100644 --- a/packages/core/test_resources/actual_data/assets_package_exclude_files.gen.dart +++ b/packages/core/test_resources/actual_data/assets_package_exclude_files.gen.dart @@ -127,7 +127,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_package_parameter.gen.dart b/packages/core/test_resources/actual_data/assets_package_parameter.gen.dart index a78a9104..785fc923 100644 --- a/packages/core/test_resources/actual_data/assets_package_parameter.gen.dart +++ b/packages/core/test_resources/actual_data/assets_package_parameter.gen.dart @@ -108,7 +108,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: 'test'); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart index d9e0b151..7a94a46a 100644 --- a/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart @@ -84,7 +84,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_snake_case.gen.dart b/packages/core/test_resources/actual_data/assets_snake_case.gen.dart index de9d9dbb..45fcdd55 100644 --- a/packages/core/test_resources/actual_data/assets_snake_case.gen.dart +++ b/packages/core/test_resources/actual_data/assets_snake_case.gen.dart @@ -140,7 +140,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart index ffb24775..55562770 100644 --- a/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart @@ -96,7 +96,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName; diff --git a/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart b/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart index 8eecfe7d..88796c3b 100644 --- a/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart +++ b/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart @@ -83,7 +83,7 @@ class AssetGenImage { ); } - ImageProvider provider() => AssetImage(_assetName); + ImageProvider provider() => AssetImage(_assetName, package: null); String get path => _assetName;