stream_duration 4.2.2 copy "stream_duration: ^4.2.2" to clipboard
stream_duration: ^4.2.2 copied to clipboard

A dart package for stream duration, support countdown, countup, and countup infinity.

cover #

A dart package for stream duration, support countdown, countup, and countup infinity.


Example Countdown #

import 'package:stream_duration/stream_duration.dart';


void main() {
  /// Countdown
  final streamDuration = StreamDuration(
    config: StreamDurationConfig(
      autoPlay: true,
      countDownConfig: CountDownConfig(
        duration: Duration(seconds: 10),
      ),
      onDone: () => print('Stream Done 👍'),
    ),
  );

  streamDuration.durationLeft.listen((event) {
    print(event.inSeconds);
  });
}

Output Countdown #

output


Example Count Up #

import 'package:stream_duration/stream_duration.dart';


void main() {
   /// Countup
  final streamDuration = StreamDuration(
    config: StreamDurationConfig(
      autoPlay: true,
      isCountUp: true,
      countUpConfig: CountUpConfig(
        /// the duration count up will start from zero
        initialDuration: Duration.zero,
        /// max duration can count up; 
        /// onDone will called if current duration 
        /// greater than equals maxDuration
        maxDuration: Duration(seconds: 10),
      ),
      onDone: () => print('Stream Done 👍'),
    ),
  );

  streamDurationUp.durationLeft.listen((event) {
    print(event.inSeconds);
  });
}

Output Count Up #

output up


Example Count Up Infinity #

import 'package:stream_duration/stream_duration.dart';


void main() {
  final streamDuration = StreamDuration(
    config: StreamDurationConfig(
      autoPlay: true,
      isCountUp: true,
      countUpConfig: CountUpConfig(
        /// the duration count up will start from zero
        initialDuration: Duration.zero,
        /// set max duration as null
        /// for infinity count up 
        maxDuration: null,
      ),
      /// onDone never called 
      onDone: () => print('Stream Done 👍'),
    ),
  );
}

Output Count Up Infinity #

output infinity


🚧 Maintener #

account avatar
Farhan Fadila
📫 How to reach me: farhan.fadila1717@gmail.com

❤️ Suport Maintener #

badge paypal badge linktree

7
likes
140
pub points
80%
popularity

Publisher

verified publisherfarhanfadila.site

A dart package for stream duration, support countdown, countup, and countup infinity.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on stream_duration