This article was drafted with AI help and reviewed by the author.

A booking screen has a happy path and a spinner. Real life adds a third thing, which is a screen that says nothing useful because the app does not know what happened.

Picture a customer on a train. They pick a Thursday window and tap Book. The signal drops. Did the job get created? The app cannot tell. If the screen shows an error and the customer taps again, they may book twice. If it shows success and nothing happened, they will wait at home for a technician who is not coming.

This post is about the client side of a booking flow whose backend talks to Housecall Pro. The Housecall Pro facts here come from its public API overview, read on 2 December 2026, plus general Flutter practice. The names and times below are sample data.

The app is not allowed to hold the key

Housecall Pro says an API key opens up everything stored in the account. The key is either Full access or Read-only, and nothing narrower. Even a Read-only key can read customer records.

A phone app is a public place. Anything inside the package or in memory can be extracted. So the Housecall Pro key never goes into the Flutter app, into a build-time define, or into a remote config value.

The app calls your own backend instead. It signs in with a normal user session, for example one from Supabase Auth, and the backend holds the key. A Supabase Edge Function with the key stored as a secret is one way to do it. The app only ever asks your backend three questions. What windows are open, please book this one, and what happened to request number such and such.

Four outcomes, and the compiler should make you handle each

Model the result of a booking as a closed set of states. In Dart 3 a sealed class with a switch that must cover every case does this well. If someone adds a fifth state later, the build fails until every screen handles it.

The four states are these.

  • Confirmed. The backend created the job and verified it. Show the window and a reference.
  • Slot taken. The window was open when the list loaded and is gone now. Show the next open windows in the same list, and keep the customer's other answers. Do not make them start over.
  • Needs a person. The backend could not decide, for example when the customer asked for something the calendar cannot express. Say plainly that the office will confirm. Never show "booked".
  • Unknown. The request left the phone and no answer came back.

Unknown is the one most apps leave out. It needs its own screen. Something like "We are checking whether your booking went through". Never a red error.

Make the request id before the tap

Generate a request id on the device when the customer opens the confirm step. Keep it in the screen state, and write it to local storage at the moment of the tap.

Send the id with every call. Your backend uses it to make a repeated call safe. The same id means the same booking, so a second tap or a retry returns the first result instead of creating another job. The backend owes you that rule. The app's job is to send the same id each time.

What the app does after a dropped connection

If the call fails with no answer, the app moves to Unknown. Then it asks the backend for the status of that id.

  • While the status is pending or missing, ask again with a growing pause between attempts.
  • Stop after a fixed number of tries. Move to a "we will contact you" message, and tell the customer to check with the office before booking elsewhere.
  • Cancel the timer when the screen is disposed. A forgotten polling timer is a classic leak.

The same check runs when the app comes back from the background. Listen to the app lifecycle, and when it resumes with a stored request id that has no final state, ask for its status. Otherwise a customer who locked their phone mid-booking returns to a spinner that never ends.

One honest limit. Cancelling the HTTP call on the phone does not cancel the work on the server. If the customer backs out of the screen, you have stopped waiting, not stopped booking. Say so in the copy, and let the confirmed state show up in the customer's list of bookings later.

A sample trip through the states

Sam Example opens the app at 8:00 and sees a Thursday 10 to 12 window. They think about it for five minutes. At 8:05 they tap Book.

The first answer from the backend is Slot taken, because the office filled that window at 8:03. The screen keeps Sam's address and notes, refreshes the list, and shows Thursday 1 to 3 as the next choice. Sam taps it. The request id changes, because this is a different booking.

Midway the train enters a tunnel. The app moves to Unknown and keeps the new id. When the signal returns, the status call says Confirmed. The screen shows the window and the reference. No second booking was made.

Small things that matter

  • Show times in the business's time zone, not the phone's. A customer who is travelling should not see a window shifted by their own clock.
  • Disable the Book button as soon as it is tapped, and keep it disabled in Unknown.
  • Keep the status check short and cheap. It may run many times for one customer.
  • Log the request id, never the customer's details, and never any key.

Takeaways

  • The Housecall Pro key stays on the backend, because it reaches the whole account.
  • Model Confirmed, Slot taken, Needs a person and Unknown as separate states.
  • Create the request id on the device, store it before the tap, and resend it on every retry.
  • On a dropped connection or a resume, ask for the status instead of tapping again.
  • Cancelling the call on the phone does not cancel the booking on the server.

For the backend view of when a custom booking build is justified in the first place, see this Housecall Pro integration blog.

References