Repository: FlutterGen/flutter_gen

Issue:
[BUG]: Need option to generate only String constants without AssetGenImage
### Is there an existing issue for this?

- [x] I have searched the existing issues

### Version

5.8.0

### Command type

build_runner (Default)

### What happened?

### Description
Currently, FlutterGen always generates `AssetGenImage` types for image assets. In our project, we need to use only String constants for asset paths (like `static const String imagesLogo = 'assets/images/logo.png'`) without the `AssetGenImage` wrapper class. This is particularly important for projects migrating from string-based asset references or maintaining compatibility with existing codebases.

### Current Behavior
```dart 
class Assets {
    static const AssetGenImage imagesLogo = AssetGenImage('assets/images/logo.png');
}
```

### Desired Behavior
```dart
class Assets {
    static const String imagesLogo = 'assets/images/logo.png';
}
```

### Relevant a pubspec.yaml.

```yaml
#资源文件生成配置
flutter_gen:
  output: lib/generated/ # 输出目录
  line_length: 80 # 行长度，过长时会自动换行
  
  integrations:
    flutter_svg: false   # 禁用 svg 集成
    flare_flutter: false # 禁用 flare 集成
    rive: false         # 禁用 rive 集成
    lottie: false       # 禁用 lottie 集成
    
  assets:
    outputs:
      class_name: Assets
      style: camel-case  # 使用驼峰命名
      package_parameter_enabled: false  # 不生成包参数

flutter:
  generate: false
  uses-material-design: true
  assets:
    - images/
    - images/2.0x/
    - images/3.0x/
    - audios/
    - assets/
```

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct



Fix patch:
diff --git a/README.md b/README.md
index 7515e708..2e674ae4 100644
--- a/README.md
+++ b/README.md
@@ -147,6 +147,7 @@ flutter_gen:
 
   # Optional
   integrations:
+    image: true
     flutter_svg: true
     rive: true
     lottie: true
@@ -370,6 +371,15 @@ Widget build(BuildContext context) {
 
 ```
 
+If you do not want to generate `AssetGenImage`, set `flutter_gen > integrations > image` to `false`.
+
+```yaml
+# pubspec.yaml
+flutter_gen:
+  integrations:
+    image: false
+```
+
 If you are using SVG images with [flutter_svg](https://pub.dev/packages/flutter_svg) you can use the integration feature.
 
 ```yaml
diff --git a/packages/core/lib/generators/assets_generator.dart b/packages/core/lib/generators/assets_generator.dart
index a426891f..3b0a3222 100644
--- a/packages/core/lib/generators/assets_generator.dart
+++ b/packages/core/lib/generators/assets_generator.dart
@@ -59,10 +59,11 @@ Future<String> generateAssets(
   }
 
   final integrations = <Integration>[
-    ImageIntegration(
-      config.packageParameterLiteral,
-      parseMetadata: config.flutterGen.parseMetadata,
-    ),
+    if (config.flutterGen.integrations.image)
+      ImageIntegration(
+        config.packageParameterLiteral,
+        parseMetadata: config.flutterGen.parseMetadata,
+      ),
     if (config.flutterGen.integrations.flutterSvg)
       SvgIntegration(
         config.packageParameterLiteral,
diff --git a/packages/core/lib/settings/config_default.dart b/packages/core/lib/settings/config_default.dart
index 32fd4900..396f2a85 100644
--- a/packages/core/lib/settings/config_default.dart
+++ b/packages/core/lib/settings/config_default.dart
@@ -11,6 +11,7 @@ flutter_gen:
 
   # Optional
   integrations:
+    image: true
     flutter_svg: false
     rive: false
     lottie: false
diff --git a/packages/core/lib/settings/pubspec.dart b/packages/core/lib/settings/pubspec.dart
index cd819ad1..314f260c 100644
--- a/packages/core/lib/settings/pubspec.dart
+++ b/packages/core/lib/settings/pubspec.dart
@@ -157,6 +157,7 @@ class FlutterGenFonts {
 @JsonSerializable()
 class FlutterGenIntegrations {
   const FlutterGenIntegrations({
+    required this.image,
     required this.flutterSvg,
     required this.rive,
     required this.lottie,
@@ -165,6 +166,9 @@ class FlutterGenIntegrations {
   factory FlutterGenIntegrations.fromJson(Map json) =>
       _$FlutterGenIntegrationsFromJson(json);
 
+  @JsonKey(name: 'image', required: true)
+  final bool image;
+
   @JsonKey(name: 'flutter_svg', required: true)
   final bool flutterSvg;
 
diff --git a/packages/core/lib/settings/pubspec.g.dart b/packages/core/lib/settings/pubspec.g.dart
index 54afbacf..827200ef 100644
--- a/packages/core/lib/settings/pubspec.g.dart
+++ b/packages/core/lib/settings/pubspec.g.dart
@@ -185,10 +185,11 @@ FlutterGenIntegrations _$FlutterGenIntegrationsFromJson(Map json) =>
       ($checkedConvert) {
         $checkKeys(
           json,
-          allowedKeys: const ['flutter_svg', 'rive', 'lottie'],
-          requiredKeys: const ['flutter_svg', 'rive', 'lottie'],
+          allowedKeys: const ['image', 'flutter_svg', 'rive', 'lottie'],
+          requiredKeys: const ['image', 'flutter_svg', 'rive', 'lottie'],
         );
         final val = FlutterGenIntegrations(
+          image: $checkedConvert('image', (v) => v as bool),
           flutterSvg: $checkedConvert('flutter_svg', (v) => v as bool),
           rive: $checkedConvert('rive', (v) => v as bool),
           lottie: $checkedConvert('lottie', (v) => v as bool),


Test patch:
diff --git a/packages/core/test/assets_gen_integrations_test.dart b/packages/core/test/assets_gen_integrations_test.dart
index 123d60df..36bc67fa 100644
--- a/packages/core/test/assets_gen_integrations_test.dart
+++ b/packages/core/test/assets_gen_integrations_test.dart
@@ -31,6 +31,7 @@ class TestIntegration extends Integration {
 void main() {
   group('Test Assets Integration generator', () {
     final resPath = p.absolute('test_resources');
+
     test('Assets with No integrations on pubspec.yaml', () async {
       const pubspec = 'test_resources/pubspec_assets_no_integrations.yaml';
       const fact = 'test_resources/actual_data/assets_no_integrations.gen.dart';
@@ -40,6 +41,16 @@ void main() {
       await expectedAssetsGen(pubspec, generated, fact);
     });
 
+    test('Assets with no image integration', () async {
+      const pubspec = 'test_resources/pubspec_assets_no_image_integration.yaml';
+      const fact =
+          'test_resources/actual_data/assets_no_image_integration.gen.dart';
+      const generated =
+          'test_resources/lib/gen/assets_no_image_integration.gen.dart';
+
+      await expectedAssetsGen(pubspec, generated, fact);
+    });
+
     test('Integration.classInstantiate', () {
       expect(
         TestIntegration().classInstantiate(
diff --git a/packages/core/test_resources/actual_data/assets_no_image_integration.gen.dart b/packages/core/test_resources/actual_data/assets_no_image_integration.gen.dart
new file mode 100644
index 00000000..ae0c5c0d
--- /dev/null
+++ b/packages/core/test_resources/actual_data/assets_no_image_integration.gen.dart
@@ -0,0 +1,109 @@
+/// GENERATED CODE - DO NOT MODIFY BY HAND
+/// *****************************************************
+///  FlutterGen
+/// *****************************************************
+
+// coverage:ignore-file
+// ignore_for_file: type=lint
+// ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use
+
+class $PicturesGen {
+  const $PicturesGen();
+
+  /// File path: pictures/chip5.jpg
+  String get chip5 => 'pictures/chip5.jpg';
+
+  /// List of all assets
+  List<String> get values => [chip5];
+}
+
+class $AssetsImagesGen {
+  const $AssetsImagesGen();
+
+  /// File path: assets/images/chip1.jpg
+  String get chip1 => 'assets/images/chip1.jpg';
+
+  /// File path: assets/images/chip2.jpg
+  String get chip2 => 'assets/images/chip2.jpg';
+
+  /// Directory path: assets/images/chip3
+  $AssetsImagesChip3Gen get chip3 => const $AssetsImagesChip3Gen();
+
+  /// Directory path: assets/images/chip4
+  $AssetsImagesChip4Gen get chip4 => const $AssetsImagesChip4Gen();
+
+  /// Directory path: assets/images/icons
+  $AssetsImagesIconsGen get icons => const $AssetsImagesIconsGen();
+
+  /// File path: assets/images/logo.png
+  String get logo => 'assets/images/logo.png';
+
+  /// File path: assets/images/profile.jpg
+  String get profileJpg => 'assets/images/profile.jpg';
+
+  /// File path: assets/images/profile.png
+  String get profilePng => 'assets/images/profile.png';
+
+  /// List of all assets
+  List<String> get values => [chip1, chip2, logo, profileJpg, profilePng];
+}
+
+class $AssetsJsonGen {
+  const $AssetsJsonGen();
+
+  /// File path: assets/json/list.json
+  String get list => 'assets/json/list.json';
+
+  /// File path: assets/json/map.json
+  String get map => 'assets/json/map.json';
+
+  /// List of all assets
+  List<String> get values => [list, map];
+}
+
+class $AssetsImagesChip3Gen {
+  const $AssetsImagesChip3Gen();
+
+  /// File path: assets/images/chip3/chip3.jpg
+  String get chip3 => 'assets/images/chip3/chip3.jpg';
+
+  /// List of all assets
+  List<String> get values => [chip3];
+}
+
+class $AssetsImagesChip4Gen {
+  const $AssetsImagesChip4Gen();
+
+  /// File path: assets/images/chip4/chip4.jpg
+  String get chip4 => 'assets/images/chip4/chip4.jpg';
+
+  /// List of all assets
+  List<String> get values => [chip4];
+}
+
+class $AssetsImagesIconsGen {
+  const $AssetsImagesIconsGen();
+
+  /// File path: assets/images/icons/dart@test.svg
+  String get dartTest => 'assets/images/icons/dart@test.svg';
+
+  /// File path: assets/images/icons/fuchsia.svg
+  String get fuchsia => 'assets/images/icons/fuchsia.svg';
+
+  /// File path: assets/images/icons/kmm.svg
+  String get kmm => 'assets/images/icons/kmm.svg';
+
+  /// File path: assets/images/icons/paint.svg
+  String get paint => 'assets/images/icons/paint.svg';
+
+  /// List of all assets
+  List<String> get values => [dartTest, fuchsia, kmm, paint];
+}
+
+class Assets {
+  const Assets._();
+
+  static const $AssetsImagesGen images = $AssetsImagesGen();
+  static const $AssetsJsonGen json = $AssetsJsonGen();
+  static const $PicturesGen pictures = $PicturesGen();
+}
diff --git a/packages/core/test_resources/pubspec_assets_no_image_integration.yaml b/packages/core/test_resources/pubspec_assets_no_image_integration.yaml
new file mode 100644
index 00000000..e2efd44f
--- /dev/null
+++ b/packages/core/test_resources/pubspec_assets_no_image_integration.yaml
@@ -0,0 +1,21 @@
+name: test
+
+flutter_gen:
+  output: lib/gen/ # Optional (default: lib/gen/)
+  line_length: 80 # Optional (default: 80)
+
+  integrations:
+    image: false
+
+flutter:
+  assets:
+    - assets/images
+    - assets/images/chip3/chip3.jpg
+    - assets/images/chip3/chip3.jpg # duplicated
+    - assets/images/chip4/
+    - assets/images/icons/fuchsia.svg
+    - assets/images/icons/kmm.svg
+    - assets/images/icons/paint.svg
+    - assets/images/icons/dart@test.svg
+    - assets/json/
+    - pictures/chip5.jpg