MethodChannelTimerun constructor

MethodChannelTimerun()

Implementation

MethodChannelTimerun() {
  methodChannel.setMethodCallHandler((call) async {
    final args = call.arguments;
    switch (call.method) {
      case "update":
        final cs = args["currentSeries"];
        final ts = args["totalSeries"];
        final cr = args["currentRepetition"];
        final tr = args["totalRepetitions"];
        final seg = args["currentSeconds"];
        final tp = args["pauseTime"];
        final state = getState(args["currentState"]);

        listen?.onUpdate(cs, ts, cr, tr, seg, tp, state);
        break;
      case "finish":
        listen?.onFinish();
        break;
      case "changeState":
        listen?.onChange(getState(args["state"]));
        break;
    }
  });
}