Repository: flutter
Issue: [camera] Exception for calling availableCameras() with cached engine and FlutterFragment on Android
Labels: c: crash,platform-android,engine,a: existing-apps,p: camera,package,has reproducible steps,P2,team-android,triaged-android,found in release: 3.22,found in release: 3.23

### Steps to reproduce

Create an Android project with add-to-app Flutter module, cached engine and navigation to/from FlutterFragment as in [example](https://github.com/theManWithoutQualities/TryFlutterModule)
Add call of availableCameras() in flutter code after navigation to FlutterFragment.
In application: navigate to FlutterFragment -> close it by back button -> open new FlutterFragment


### Expected results

No exception for availableCameras()

### Actual results

Exception for availableCameras()
```
PlatformException(java.lang.NullPointerException, NullPointerException, Cause: null, Stacktrace: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:220)
at io.flutter.plugins.camerax.CameraSelectorHostApiImpl.filter(CameraSelectorHostApiImpl.java:49)
at io.flutter.plugins.camerax.GeneratedCameraXLibrary$CameraSelectorHostApi.lambda$setup$1(GeneratedCameraXLibrary.java:1039)
at io.flutter.plugins.camerax.GeneratedCameraXLibrary$CameraSelectorHostApi$$ExternalSyntheticLambda1.onMessage(D8$$SyntheticClass:0)
at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
, null)
```

### Code sample

[Code in example project](https://github.com/theManWithoutQualities/TryFlutterModule/blob/main/flutter_module/lib/main.dart)

### Screenshots or Video

_No response_

### Logs

_No response_

### Flutter Doctor output

flutter doctor -v
```
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-x64, locale en-BY)
    • Flutter version 3.22.2 on channel stable at /Users/mikalai/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (4 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/mikalai/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_SDK_ROOT = /Users/mikalai/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.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 17.0.10+0-17.0.10b1087.21-11609105)

[✓] VS Code (version 1.85.1)
    • VS Code at /Users/mikalai/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.5 23F79 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 126.0.6478.127

[✓] Network resources
    • All expected network resources are available.
```