Spokalyالإنجليزية تبدأ من السمع
Job interviews · Software developer · Advanced

Flutter Developer: State, Offline Data and a Janky Listمقابلة مطوّر Flutter: إدارة الحالة والبيانات دون إنترنت وقائمة متقطعة

  • Dalia
  • Omar
0:00 / 2:42
The coloured strip is split by speaker, so you can see who talks and when.

Transcript

  1. Dalia
    Hi Omar. Let's start with something simple. Tell me about a Flutter app you built and one decision you'd change.
  2. Omar
    I built a food delivery app for a restaurant group, with menus, a cart and order tracking. I'd change one thing: I kept too much logic inside the widgets at first, so it was hard to test. Later I moved it into separate classes.
  3. Dalia
    Which state management approach did you use, and why?
  4. Omar
    I used Riverpod in the later version. The main reason was testing: I can replace a provider with a fake one in a test. Before that I used setState for everything, which is fine for small local state but doesn't scale when many screens share data.
  5. Dalia
    Have you used Bloc?
  6. Omar
    Only in a small course project. I understand the idea of events and states, but I haven't used it in production, so I won't claim I'm an expert. I'd learn quickly because the concepts are similar.
  7. Dalia
    Now a requirement: the app must show the last orders even without internet. How would you design it?
  8. Omar
    I'd store data in a local database, for example SQLite or a similar package. The screen would always read from the local database, and a repository would fetch from the server in the background and update the database. That way the screen works the same online and offline.
  9. Dalia
    What if the user creates an order while offline?
  10. Omar
    I'd save it locally as pending, show it with a clear 'waiting to send' label, and send it when the connection returns. I'd give every order a unique ID created on the device, so a retry can't create a duplicate. The harder part is conflicts, for example if the price changed meanwhile, so the server should have the final decision.
  11. Dalia
    Different topic. A list of products scrolls with dropped frames, especially with images. How would you investigate?
  12. Omar
    I'd run the app in profile mode, not debug mode, and open DevTools to see which frames take too long. Then I'd check three things: whether the list uses a builder constructor so it builds only visible items, whether the images are much bigger than the screen size, and whether something rebuilds the whole list on every scroll.
  13. Dalia
    Why profile mode and not debug?
  14. Omar
    Debug mode includes extra checks and is much slower, so the numbers aren't realistic. Also, I'd test on a real, low-end phone, because that's where users will see the problem.
  15. Dalia
    Good. Last question: how do you keep your skills current?
  16. Omar
    I read the release notes for each new Flutter version, I build a small side project to try new ideas, and I read other people's code on GitHub. Right now I'm learning more about testing.
  17. Dalia
    Thanks, Omar. We'll let you know by Thursday.