Skip to content

Flutter version 3.7 is not reading asset variants #119462

@anqit

Description

@anqit

Steps to Reproduce

I am developing an app and am testing mostly in the mobile simulators. I have different config files for the different platforms that I have specified in the assets section of pubspec.yaml and am relying on variants to modify the config files per environment. So my assets section looks like this:

  assets:
    # ... other assets
    - config/android.json
    - config/ios.json

while my directory structure looks something like

config/
    local/    // <- directory per env
        android.json
        ios.json
    dev/
        android.json
        ios.json
    prod/
        android.json
        ios.json
 // etc

This has been working for me while using flutter up to version 3.3.10. However, after upgrading to 3.7, starting the app in at least the iOS simulator leads to the error No file or variants found for asset: config/android.json. After flutter downgrade 3.3.10, my app works as before.

Expected results:
App runs as before, asset variants are found and accessible

Actual results:
Error finding non-variant asset

Details ``` $ flutter doctor -v [✓] Flutter (Channel stable, 3.7.0, on macOS 11.6.1 20G224 darwin-x64, locale en-US) • Flutter version 3.7.0 on channel stable at /usr/local/Caskroom/flutter/3.0.1/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision b06b8b2 (6 days ago), 2023-01-23 16:55:55 -0800 • Engine revision b24591ed32 • Dart version 2.19.0 • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/ankit/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13C100
• CocoaPods version 1.11.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 71.3.6
• Dart plugin version 223.8214.16

[✓] Connected device (3 available)
• iPhone 13 (mobile) • 521F6361-7E1B-4F3A-A40D-81AAC09D220E • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 11.6.1 20G224 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

</details>

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions