Как добавить Listner в объект в DART

import 'dart:async';

class BaseModel {
  Map objects;
  StreamController fetchDoneController = new StreamController.broadcast();

  // define constructor here

  fetch() {
    // fetch json from server and then load it to objects
    // emits an event here
    fetchDoneController.add("all done"); // send an arbitrary event
  }

  Stream get fetchDone => fetchDoneController.stream;

}


// over in youre app file

main() {
  var model = new BaseModel();
  model.fetchDone.listen((_) => doCoolStuff(model));
}
Adorable Alpaca