Kikki
Kikki

Reputation: 505

Specify same package id for all home widgets in Flutter Home Widget

I am trying to create widget in Flutter using the Flutter home package. https://pub.dev/packages/home_widget

I could successfully do it in iOS.

But when done for Android, I get the following error because of different build variants.

Unhandled Exception: PlatformException(-3, No Widget found with Name HomeWidgetExampleProvider. Argument 'name' must be the same as your AppWidgetProvider you wish to update, java.lang.ClassNotFoundException: com.myappvariant.HomeWidgetExampleProvider.

How can I make only one class for all the build variants and keep the same id for the Home Widget.

Upvotes: 1

Views: 698

Answers (1)

taroooth
taroooth

Reputation: 1

Try this.

HomeWidget.updateWidget(qualifiedAndroidName: 'com.yourappvariant.HomeWidgetExampleProvider');

Here may be a hint. https://github.com/ABausG/home_widget/blob/main/android/src/main/kotlin/es/antonborri/home_widget/HomeWidgetPlugin.kt#L79-L93

Upvotes: 0

Related Questions