My First Two Flutter Plugins and Track My Indoor Workout News
Jul 22, 2023
Last time I talked about how I prepared Track My Indoor Workout for contributions and Google Dev Library and thoughts on installing Flutter from Snap. This current post would be more along the line of Dart null safety and Flutter embedding API deprecation. Both of those latter require refactoring and sorting out those plugins which lag behind maintenance.
The latest big changes along the front line are Dart 3.0 and accompanying new Flutter versions, and overlapping with that is the Android Gradle Plugin (AGP) upgrade to version 8.0 and beyond. During the Dart null safety times pub.dev/packages was badging the plugins whether they supported null safety or not, nowadays the main badge on the plugin front page is about Dart 3 compatibility. The null safety badge is still there under the Versions tab.
Just like during the null safety I ended up attacking the changes head-on and taking a forward fleeing strategy. I’m already on the Flutter beta channel (Dart 3.1) and I iterated through my plugin dependencies. I tried to upgrade to the latest version of everything, switching to a better-maintained fork if available (qr_widget instead of qr_flutter for example), or eliminating a plugin if possible (easy_folder_picker, bluetooth_enable_fork). But the biggest whop was when I decided to carry some plugins on my back and created my plugins. In the past (and still today) it wasn’t uncommon for me to report bugs and craft PRs to help plugins. Sometimes I cannibalized code if a plugin was UI-only (no platform-specific parts) and for some reason, the maintenance was lagging. I reached new heights and I created two plugins:
- fab_circular_menu_plus which was cannibalized source for a while because a critical error (unclickable menus) was never fixed, even though I debugged it and crafted a PR.
- listview_utils_plus to make it fully Dart 3.1 compliant. It’s somewhat concerning that the original author doesn’t advise the use of the plugin, but it is a compact perfect use if you want to feed a listview from a back-end with many entity rows and you’d want to lazily page it.
Both of these plugins are UI only, so I didn’t have to deal with platform-dependent sections. I’m happy to claim my first two plugins even though necessity dictated me to leap.
As far as Track My Indoor Workout features go numerous major changes are coming. The biggest one is the replacement of the current Floor based (wrapper over Sqflite) database persistence back-end to Isar. I was eyeing object databases for a long time now such as hive, sembast, or objectbox until heard of Isar at a Flutter meetup and HumpDayQnA. I studied more about it and it won my selection process.
It took a long time to maintain the feature branch in concert with the main development branch. My app uses it in the beta release track, it has some risky procedures such as a database migration process from Floor/Sqflite to Isar the first time the athlete starts the new version of the app. It’s a testament to Isar that the whole migration of about 350 workouts takes less time than importing a CSV workout file with Floor before. This means that Isar is truly more than 100 times faster than the old back-end. The slowness put a burden on the whole UI responsiveness since fitness machines tend to send data multiple times a second. It even posed a challenge for old devices or weak tablets. Isar will greatly help with all of that even though I haven’t introduced RiverPod yet and I’m using setState style UI updates.
As far as fitness machine support I had a mad dash to try to finish the Kayak First ergometer support so the company would be able to show my application at the FIBO Fitness Expo in Köln from April 11-14 2023. The communication protocol of the console of this machine is different from any other machine so I needed to refactor the core logic of my app. I can use the app with Android 6 (ASUS ZenFone), Android 9 (Motorola Moto g6), and Android 12 (OnePlus Nord EU G5) phones. Unfortunately, the manufacturer still has some glitches so we need to iterate more, but hopefully, it’ll be in the bag this year.
I’ll also soon put in time for the Concept2 RowErg. I was in Costa Rica for a week and the hotel’s gym had not only a C2 RowErg, but also a C2 SkiErg (even a C2 BikeErg, but that was out of commission). Unfortunately, I didn’t have time to work on the support. However I have access to a RowErg here in Fresno (thanks to Raw Fresno), and I’ll complete both the proprietary C2 protocol and the FTMS (for the newer consoles).
The Kayak First induced coe refactorings broke the support for Schwinn 170, 270, and 570, about three users reported that, but fortunately with some help I was able to restore it with some meticulous code review (since I don’t own such machines). It’s hard to provide support for a machine when I don’t have access to it. There are still outstanding support requests for:
- Nautilus B616 Recumbent bike
- Topiom Rowing Machine
- Pooboo Chinesium FTMS bike
- Stryd Footpod
- Bowflex TC200 Tread Climber
With a lot of effort I’m happy to provide different running, cycling, and swimming tracks for each different time zones. This is not per country yet, but at least should solve problems with time zone misalignment of uploaded workouts. Highly asked features is localization, that will be a big undertaking, but it would be so great! I want to be able to tell apart speed sensors from cadence sensors by looking at their appearance data. Flutter Blue Plus doesn’t support that yet, but I provided a PR. Chip Weinberger put so much effort into the plugin that I have to recreate my PR because the Protobuf was removed. I’m happy that there’s a very active maintainer.
If you have any feature request or issue report don’t hesitate to file one on GitHub or contact me.