Menu

Our Flutter app's purchase events vanished before the user logged in
📰

Our Flutter app's purchase events vanished before the user logged in

DEV Community: dart·HS Solution·5 days ago
#soSsSo9f
#devtodart#devto#dev#event#code
Reading 0:00
15s threshold

Our billing code logged store_ready on every cold start.

On some starts, that event never reached the server.

The billing layer was fine. Our own analytics wrapper was throwing the events away. This is a short write-up of that bug from our Flutter fortune app, and the small fix.

The setup

The app has a small analytics wrapper, Backend.event(name, props) . It only sends when the backend session is live:

bool get _live => ready && _api . usable ;

Future < void > event ( String name , [ Map < String , dynamic > props = const { } ] ) async { if ( ! _live ) return ; // no session yet -> drop // ...send }

Enter fullscreen mode

Exit fullscreen mode

For screen events that is fine. A user who has not signed in yet has not seen a screen worth measuring.

The billing layer is different. On a cold start it queries the store for products right away, with a retry loop.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.