generic_pool 0.0.4

Dart native js
Flutter Android iOS web

A starting point for Dart libraries or applications.

generic_pool #

Usage #

import 'package:generic_pool/generic_pool.dart' as pool;

main() async {
  var dial = () async {
    print('+1');
    return 'a';
  };

  var close = (dynamic c) async {
    print('-1');
  };

  var cc = pool.pool(dial, close, 1, maxActive: 2);
  try {
    await cc.get();
    await cc.get();
    var x = await cc.get();
    await cc.get();
    print(x);
    await cc.put(x, false);
    print(cc.activeCount);
    var xx = await cc.get();
    await cc.put(xx, true);
    print(cc.activeCount);
  } on Exception catch (e) {
    print(e == pool.ErrPoolExhausted);
  }
}
0
likes
80
pub points
0%
popularity

A starting point for Dart libraries or applications.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

lijian@conew.com

License

BSD (LICENSE)

More

Packages that depend on generic_pool