swiss_knife 3.2.0 copy "swiss_knife: ^3.2.0" to clipboard
swiss_knife: ^3.2.0 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
140
pub points
70%
popularity

Publisher

unverified uploader

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