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

outdated

Dart Useful Tools - collections, math, date, uri, json, events, resources, 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
0
pub points
76%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

intl, resource_portable

More

Packages that depend on swiss_knife