swiss_knife 3.2.1 copy "swiss_knife: ^3.2.1" to clipboard
swiss_knife: ^3.2.1 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
160
pub points
76%
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