Repository: flutter
Issue: FragmentProgram.fromAsset throws misleading exception
Labels: tool,has reproducible steps,P2,found in release: 3.10,found in release: 3.11,team-tool,triaged-tool

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Create a Flutter app with a shader. For example, https://github.com/flutter/samples/tree/main/simple_shader.
2. Edit `pubspec.yaml` so that the path to the shader is _also_ included in the `assets` record:

```yaml
...

flutter:
  # Add this.
  assets:
    - shaders/

  shaders:
    - shaders/simple.frag
```

Note that this can easily happen if one wants to have shaders next to related pictures, for example. In my case, I had a folder called `assets/patterns/` which included pattern PNGs as well as a fragment shader for simple cross hatch patterns.

3. Try running the program.

### Expected results

Program runs. Or it fails at compile time, telling me something like "shader cannot be compiled since it's already included in the asset bundle".

### Actual results

Program fails at runtime. 

    Exception: Asset 'shaders/simple.frag' does not contain valid shader data.

It looks like having the shader (even unintentionally) in `assets` prevents the mechanism behind shader support from firing. 

The resulting error is a red herring. I spent an hour trying to "fix" the fragment shader.


### Code sample

https://github.com/flutter/samples/blob/main/simple_shader/ + changes above

### Screenshots or Video

_No response_

### Logs

<details><summary>Logs</summary>

```console
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Asset 'shaders/diagonal_crosshatch.frag' does not contain valid shader data.
#0      new FragmentProgram._fromAsset (dart:ui/painting.dart:4328:7)
#1      FragmentProgram.fromAsset.<anonymous closure> (dart:ui/painting.dart:4355:55)
#2      new Future.microtask.<anonymous closure> (dart:async/future.dart:280:37)
#3      _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#4      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)


```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[!] Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US)
    • Flutter version 3.10.0 on channel stable at /Users/filiph/fvm/versions/beta
    ! Warning: `flutter` on your path resolves to /Users/filiph/fvm/versions/stable/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/filiph/fvm/versions/beta. Consider adding /Users/filiph/fvm/versions/beta/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/filiph/fvm/versions/stable/bin/dart, which is not inside your current Flutter SDK checkout at /Users/filiph/fvm/versions/beta. Consider adding /Users/filiph/fvm/versions/beta/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 84a1e904f4 (6 days ago), 2023-05-09 07:41:44 -0700
    • Engine revision d44b5a94c9
    • Dart version 3.0.0
    • DevTools version 2.23.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
    • Android SDK at /Users/filiph/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • 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.15+0-b2043.56-8887301)

[✓] VS Code (version 1.76.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 113.0.5672.92

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>