Dart + Flutter

Architecture

State

Serialization

  • 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**

Storage

  • flutter_secure_storage - uses respective platform keychains to save store
  • sqlcipher sqlite, but encrypted
  • sembast - nosql storage for flutter/dart
  • hive - nosql storage, but tightly coupled to encryption and serialization, should attempt to serialize with a separate library and cache with a different library

Flow

  • 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

Patterns

JS

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

Dart

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

UI/UX

Resources

Research

manual serialization
- incredibly overwhelming for complex models
- seems to be a better idea for the higher level containers, or Stores  
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
RawSerialization
- consider serializing as raw byte stings?
Consistant Flex Structuring
- Flexible -> Flex -> Container