attach method

void attach(
  1. OutputSource<O> box
)

Implementation

void attach(OutputSource<O> box) {
  box.listen((output) {
    if (output is AsyncData<O>) {
      if (output.value == null) {
        store.delete(key);
      } else {
        store.write(key, codec.encode(output.value));
      }
    } else if (output is SyncOutput<O>) {
      if (output.value == null) {
        store.delete(key);
      } else {
        store.write(key, codec.encode(output.value));
      }
    }
  });
}