Upgrade to Pro — share decks privately, control downloads, hide ads and more …

State management in Flutter

Kendi J
January 14, 2020
31

State management in Flutter

This is a presentation of state management in Flutter and an insight of what Flutter is

Kendi J

January 14, 2020
Tweet

Transcript

  1. What is Flutter? - Google’s mobile SDK - Creates native

    Android and iOS apps - Builds cross platform apps in record time - Uses Dart language
  2. Why is Flutter cool? - Fast cross platform development -

    Perform native experience - Lots of built in widgets - Application performance using Dart (AOT and JIT) - Hot reload - Device compatibility. Its native widgets allow applications to remain compatible from iOS 8 and Android Jelly Bean, API 16
  3. What you need to get started - IDE ❖ Android

    Studio ❖ Visual studio code ❖ IntelliJ ❖ Command line - Dart and Flutter plugins - Flutter SDK (flutter.dev)
  4. Widgets - Basic building blocks of a Flutter app’s UI,

    hence everything is a widget - Immutable - All the fields are final unless you want to make changes.
  5. Stateless and stateful widgets Stateless Widget - It is immutable

    meaning that all values are final and cannot be changed Stateful Widget - Require a mutable state - Maintain state that may change during the app’s lifecycle
  6. State management State - Data that changes over a life

    cycle of an app. Why should it be managed? - To avoid soul crushing bugs that only happen at runtime. - To optimize performance.
  7. Widget packaged in Flutter used to manage sate. - Stateful

    Widget- has setState method that you can call to repaint the widget - Stateful builder - Easier way to handle local state as it doesn’t require two classes and a decent amount of boilerplate - Stream builder - used to manage global state for its flexibility, provides separation of concerns and it feels intuitive. - Inherited Widget - provide context to every widget below it in
  8. Block Pattern - Similar to inherited widget but more intuitive

    and scalable for state management. Scoped Model - Set of utilities that allow you to pass data from parent widget down to its children. -the model class -ScopedModel class -ScopedModel descendant
  9. ReduX - De facto state management in ReactJS. Its widgets

    include: - StoreProvider - StoreBuilder - StoreConnector
  10. Provider - It’s a mixture between DI and Sate management.

    - It guarantees: - Maintainability - Testability/ compatibility - Robustness
  11. Firebase - Sate with backend - Provides a very powerful

    stream based state management library by persisting your data to the cloud. - Solves most complex requirements like - User auth - Database persistence - Remote config