getDuration method

Future<int> getDuration()
override

Returns time taken to execute this session in milliseconds or zero (0) if the session is not over yet.

Implementation

Future<int> getDuration() async {
  try {
    return _platform
        .abstractSessionGetDuration(this.getSessionId())
        .then((duration) => duration ?? 0);
  } on PlatformException catch (e, stack) {
    print("Plugin getDuration error: ${e.message}");
    return Future.error("getDuration failed.", stack);
  }
}