Dart + Flutter



  • redux - just as good in dart
  • redux_thunk - everything is an action
  • redux_persist - control in memory and cold storage data from store
  • flutter_secure_storage - uses respective platform keychains to save store
  • dart_json_mapper - generates toJson/fromJson for models but does so at build time, files generated are not saved to filesystem - supports Uint8List which will be used wherever cached images are supported - json_serializable does not support Uint8List / byte arrays in models


  • Using redux with streams

    • Timer+Store vs. Stream

      • The store itself is a stream that can be observed / listened to
      • The only thing different between them is where you want the stream within the store observed from? the view or still within the store
      • Within the store has an extra layer, but has a separation of concerns
    • Example is initializing a chat observer after authentication

      • Leaving this in the view is less friction with streams on streams
      • But you sacrifice separation of concerns
    • StreamController example

    • Converted to streams from using the global onChange and it's noticeably faster

Common Patterns


const newUsers = users.filter(user => user.new);


final newUsers = users.where(user => user.new).toList();



Redux Persist Serialization

1. manual serialization
- incredibly overwhelming for complex models
- seems to be a better idea for the higher level containers, or Stores  
2. dart_json_mapper for Json
- [lists need decorator functions](https://github.com/k-paxian/dart-json-mapper/issues/17)
- for non-store types, is sort of working without the need for toJsons
3. RawSerialization
- consider serializing as raw byte stings?


  • find a more explicit way to style with flex