Cross-posted from /r/dartlang on Reddit:
I saw the Flutter/Dart Google IO presentation and decided I wanted to make a stupid silly Android app. It was pretty easy to get started, but I couldn't find anywhere on how to do a simple lock-screen widget.
Basically I just want an app that periodically polls a JSON API and displays some data on the android lock screen. Is this possible to do with Flutter at the moment?
Disclaimer: I'm an infrastructure/backend python/golang developer who has never written anything close to a mobile app.
App Widget layouts are based on RemoteViews, which do not support many types of view widgets. Because FlutterView
extends SurfaceView
to get access to low-level graphics APIs, it can't be embedded in an app widget.
To quote CommonsWare: "At best, you can try to write your own home screen implementation that does this." But that is a much bigger project than you probably had in mind.
If you are looking for homescreen widgets for flutter use home_widget: ^0.1.5 .
HomeWidget is a Plugin to make it easier to create HomeScreen Widgets on Android and iOS. HomeWidget does not allow writing Widgets with Flutter itself. It still requires writing the Widgets with native code. However, it provides a unified Interface for sending data, retrieving data and updating the Widgets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With