Future commit(Instruction instruction, [ bool _skipLocationChange = false, bool _replaceState = false ])

Updates this router and all descendant routers according to the given instruction

Source

Future<dynamic> commit(Instruction instruction,
    [bool _skipLocationChange = false, bool _replaceState = false]) {
  this.currentInstruction = instruction;
  Future<dynamic> next = _resolveToTrue;
  if (_outlet != null && instruction.component != null) {
    var componentInstruction = instruction.component;
    if (componentInstruction.reuse) {
      next = this._outlet.reuse(componentInstruction);
    } else {
      var outlet = this._outlet;
      next = this
          .deactivate(instruction)
          .then((_) => outlet.activate(componentInstruction));
    }
    if (instruction.child != null) {
      next = next.then((_) {
        if (_childRouter != null) {
          return this._childRouter.commit(instruction.child);
        }
      });
    }
  }
  List<Future<dynamic>> promises = [];
  this._auxRouters.forEach((name, router) {
    if (instruction.auxInstruction[name] != null) {
      promises.add(router.commit(instruction.auxInstruction[name]));
    }
  });
  return next.then((_) => Future.wait(promises));
}