📅  最后修改于: 2023-12-03 15:25:31.948000             🧑  作者: Mango
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.
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.
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.
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.
There are a few solutions that you can try to resolve this compatibility issue:
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"
If you still want to use both packages together, you can fork flutter_launcher_name
and update the dependency to yaml ^3.0.0
.
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.
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.