Another busy week — Week 13 was all about addressing long-standing bugs, improving stability, and preparing for yet another live event. This time, I tackled issues ranging from JWT key retrieval to stubborn gesture conflicts that made certain UI elements unresponsive after long-presses, all while going through yet another live event and wondering why Flutter widgets seem to have a personal vendetta against me.
Simple Fixes That Actually Worked
The week started with a small task from my supervisor on GitHub: change the JWT key retrieval from attachment-based to document-field-based. It was a straightforward change, nothing fancy, just swapping how the app reads the key.
Still, I somehow managed to overthink it for a bit before realizing it was literally a few lines of code. I added a simple fallback key (DEFAULT_FAKE_KEY) in case the field isn’t found, just to be safe. Easy fix, but it felt nice to tick something off the list without breaking anything for once.
Then I went back to fix a long-standing annoyance: the confirmation dialog that refused to close properly after scanning a QR code. I added a little state variable called _lastScannedCode to keep the app from processing the same QR repeatedly and miraculously, it worked. The dialog no longer lingered like a ghost from previous events. Small win, big relief.
Error Handling, Gesture Drama, and Mild Panic
With that out of the way, I polished my earlier 429 error-handling logic for Gemini. It’s the part that politely tells users, “AI is busy, please try again later,” instead of silently breaking. I tested it again and again until it behaved the way I wanted, or at least close enough.
After that, I moved on to something I instantly regretted: the Moderator module. Apparently, there’s a weird bug where if you long-press on a performance entry, you can’t tap it again afterward. I went down a small rabbit hole reading about Flutter’s GestureDetector and GitHub threads where people seemed just as lost as I was.
No fix yet, just me, Flutter, and a growing sense of confusion.
Another Event, Another Round of Setup
Then came the Johor live event, which basically meant me running around plugging in tablets and laptops, setting up logins, and pretending to know what’s going on while praying nothing breaks in front of people.
Thankfully, the QR scanner behaved this time. The confirmation dialog finally did what it was supposed to, which honestly felt like a small miracle. Between event sessions, I went back to the Moderator bug, because of course I did.
The Breakthrough (After 500 Failed Attempts)
Turns out, the reason tapping stopped working after a long-press was because of how the widget handled state. I ended up changing HeadListTile from a Stateless (ConsumerWidget) to a Stateful (ConsumerStatefulWidget), and somehow, that fixed it.
Suddenly, taps started working again. I don’t fully trust it yet (because nothing ever works perfectly the first time), but at least for now, it seems stable.
Reflections & Insights
- Fixing one bug usually means uncovering two more, I’ve made peace with that.
- Sometimes, the smallest fixes (like tracking one variable) save you from the biggest headaches.
- Widget states are mysterious creatures, one wrong rebuild and everything stops working.
What’s Next
I’ll be waiting for feedback on my pull requests and keeping an eye on any future updates. If needed, I’ll also upgrade the Gemini SDK to the latest version.
0 Comments