When running the flutter build appbundle
command, I get the following error :
../../.pub-cache/hosted/pub.dev/package_info_plus_windows-2.1.0/lib/src/file_version_info.dart:13:17:
Error: Field 'wLanguage' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`.
external int? wLanguage;
^
../../.pub-cache/hosted/pub.dev/package_info_plus_windows-2.1.0/lib/src/file_version_info.dart:16:17:
Error: Field 'wCodePage' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`.
external int? wCodePage;
^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
I am using Flutter 3.10.0. The project was running fine before I updated the flutter version.
I finally fix my problem by overriding these packages in my project's pubspec.yaml
dependency_overrides:
package_info_plus: ^4.0.1
wakelock_windows: any
win32: any
or
dependency_overrides:
package_info_plus: any
Overriding the package_info_plus
to ^4.0.1
gave me the following error message because of my project dependencies.
Because no versions of wakelock_windows match >0.2.1 <0.3.0 and wakelock_windows <0.2.1 depends on win32 ^2.0.0, wakelock_windows <0.2.1-∞ or >0.2.1 <0.3.0 requires win32 ^2.0.0. And because wakelock_windows 0.2.1 depends on win32 ^3.0.0, wakelock_windows <0.3.0 requires win32 ^2.0.0 or ^3.0.0. And because package_info_plus >=4.0.1 depends on win32 >=4.0.0 <6.0.0 and wakelock 0.6.2 depends on wakelock_windows ^0.2.0, package_info_plus >=4.0.1 is incompatible with wakelock 0.6.2. Because chewie >=1.3.5 depends on wakelock ^0.6.2 and no versions of wakelock match >0.6.2 <0.7.0, chewie >=1.3.5 requires wakelock 0.6.2. Thus, package_info_plus >=4.0.1 is incompatible with chewie >=1.3.5. So, because start depends on both chewie ^1.4.0 and package_info_plus ^4.0.1, version solving failed.
If you have a similar message after overriding the package_info_plus
, you can check the dependent packages and add them to dependency_overrides
and set the version to any
as in my above example.
The Any
keyword can be used to specify that any version of a package is acceptable. This can be useful if you want to make sure that your app is compatible with the latest version of a package, or if you want to avoid breaking changes that may be introduced in a future version of a package.