swiss_knife 3.2.3 copy "swiss_knife: ^3.2.3" to clipboard
swiss_knife: ^3.2.3 copied to clipboard

Dart Useful Tools - collections, math, date, uri, json, events, resources, regexp, etc...

example/example.dart

import 'package:swiss_knife/swiss_knife.dart';

class Sys {
  final EventStream<bool> onLoad = EventStream();

  void initialize() {
    onLoad.add(true);

    for (var user in users) {
      user.notify('System initialized!');
    }
  }

  final List<User> users = [];

  void addUser(User user) {
    users.add(user);
  }
}

class User {
  final EventStream<String> onNotification = EventStream();

  void notify(String msg) {
    onNotification.add(msg);
  }
}

void main() {
  var sys = Sys();

  sys.onLoad.listenAsFuture().then((loaded) {
    print('${dateFormat_YYYY_MM_dd_HH_mm_ss()}> System loaded: $loaded');
  });

  var user = User();
  sys.addUser(user);

  user.onNotification.listen((msg) {
    print('${getCurrentTimeMillis()}[${getDateAmPm()}]> NOTIFICATION> $msg');
  });

  sys.initialize();
}
18
likes
150
points
6.39k
downloads

Publisher

unverified uploader

Weekly Downloads

Dart Useful Tools - collections, math, date, uri, json, events, resources, regexp, etc...

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

intl, resource_portable

More

Packages that depend on swiss_knife