Skip to content

[BUG]: Import conflict: Image class defined in flutter and rive #545

Closed
@codeOfJannik

Description

@codeOfJannik

Is there an existing issue for this?

  • I have searched the existing issues

Version

5.6.0

Command type

build_runner (Default)

What happened?

Out of nowhere we started to get an error in the generated file that a image class is found both in package/flutter/...widgets.dart and package/rive:
The name 'Image' is defined in the libraries 'package:flutter/src/widgets/image.dart (via package:flutter/widgets.dart)' and 'package:rive/src/rive_core/shapes/image.dart (via package:rive/rive.dart)'.

Anyone else already faced that issue? Has anything changed in the package?
Or did something change in rive, e.g. they started to export the image class so it's visible?

A workaround for now is to add a hide Image to the rive import manually after the assets.gen.dart file has been generated.

Our assets folder contains png, jpg, svg and riv files.

Relevant a pubspec.yaml.

dependencies:
  flutter:
    sdk: flutter
  flutter_svg: ^2.0.10+1
  rive: ^0.13.12

dev_dependencies:
  build_runner: ^2.4.11
  flutter_gen_runner: ^5.6.0
  flutter_test:
    sdk: flutter

flutter:
  assets:
    - assets/
    - assets/animations/
    - assets/images/
    - assets/images/first_time_ux/
    - assets/images/first_time_ux/alerting/de/
    - assets/images/first_time_ux/alerting/en/
    - assets/images/group/
    - assets/images/menu_icons/


flutter_gen:
  output: lib/src/generated/
  line_length: 180
  assets:
    outputs:
      package_parameter_enabled: true

  integrations:
    flutter_svg: true
    rive: true

Relevant log output

FlutterGen v5.6.0 Loading ... pubspec.yaml
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 903ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Deleting 1 declared outputs which already existed on disk.
[INFO] Checking for unexpected pre-existing outputs. completed, took 2ms

[INFO] Running build...
Generated: lib/src/generated/assets.gen.dart
FlutterGen finished.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions