📜  并且由于flutter_launcher_name的每个版本都依赖于yaml ^2.1.16,flutter_native_splash ^1.2.1与flutter_launcher_name不兼容. (1)

📅  最后修改于: 2023-12-03 15:25:31.948000             🧑  作者: Mango

Flutter_launcher_name and Flutter_native_splash Compatibility Issue

As a Flutter developer, you might have come across the issue where you cannot use flutter_launcher_name and flutter_native_splash packages together due to compatibility issues. This issue arises because every version of flutter_launcher_name depends on yaml ^2.1.16, and flutter_native_splash ^1.2.1 is incompatible with it.

Understanding Flutter_launcher_name

flutter_launcher_name is a package that allows you to change the name of your app on the device home screen. The package creates a launch_background.xml file and sets the android:windowBackground attribute to a custom color or image. Additionally, it also changes the app name in the AndroidManifest.xml file.

Understanding Flutter_native_splash

flutter_native_splash is a package that allows you to create a native splash screen for your app in both Android and iOS. The package generates the appropriate native code to display the splash screen during the launching of the app.

Compatibility Issues

The compatibility issue arises because both packages depend on different versions of the yaml package. flutter_launcher_name depends on yaml ^2.1.16, while flutter_native_splash ^1.2.1 depends on yaml ^3.0.0. The dependencies conflict, and hence you cannot use both packages together.

Possible Solutions

There are a few solutions that you can try to resolve this compatibility issue:

Using Flutter_native_splash to set the app name

Instead of using flutter_launcher_name to change the app name, you can use flutter_native_splash. The package has an option to set the app name during configuration.

flutter_native_splash:
  color: "#4B4B4B"
  image: assets/images/splash.png
  app_name: "My Cool App"
Forking flutter_launcher_name

If you still want to use both packages together, you can fork flutter_launcher_name and update the dependency to yaml ^3.0.0.

Using a custom solution

You can create your custom script to change the app name and create a splash screen. While this might take more time and effort, it gives you complete control over the process.

Conclusion

The compatibility issue between flutter_launcher_name and flutter_native_splash arises due to dependency conflicts. While there are some solutions available, it is essential to evaluate each solution's pros and cons before deciding which one to use.