babincc / flutter_workshop

This repo houses add-ons, plug-ins, and helpful code to make Flutter programming easier.
5 stars 1 forks source link

Demo app only works for first time #10

Closed shiv2299 closed 10 months ago

shiv2299 commented 10 months ago

I used the example demo app as it is. It is able to discover the bridge and control the light on first install but after reopening the app it doesn’t show the bridge ip. I am not sure what I am doing wrong.

Steps followed:

  1. Clicked on discover bridges button
  2. Pressed the button on the bridge
  3. IP shown in the app, clicked on first contact
  4. Clicked fetch network
  5. Able to control the light
  6. Kill the app and reopen and did the same steps but didn’t get any bridge ip.

Appreciate any help

babincc commented 10 months ago

The demo app is just configured to show a quick demo. It isn't meant to be used beyond that. Because of this, it is not optimized for continued use. Once you make the first connection with your bridge, that IP is saved to the device. Later on, when you try to make a new connection, that bridge doesn't show up since it is already saved to memory. The demo app doesn't look into saved memory to get previous bridges.

To fix this, you can clear the memory on the emulator every time you run the demo, or you can practice and get to know Flutter Hue by adding to the demo and retrieving the bridge from memory if it has already established a connection.

shiv2299 commented 10 months ago

I will try using fetchSavedBridges() to get the existing bridges.

shiv2299 commented 10 months ago

Hi, I was able to fetch the bridge from fetchSavedBridges. Thanks for the clarification 🙌🏻