capsule<T> function

Capsule<T> capsule<T>(
  1. Capsule<T> cap
)

Shorthand for a fully formed capsule.

Basic usage:

final countPlusOneCapsule = capsule((use) {
  return use(countCapsule) + 1;
});

Warning

Although capsule is convenient, source code created with it loses explicitly written type information. For that reason, it is strongly recommended to use capsule as such:

final Capsule<int> countPlusOneCapsule = capsule((use) {
  return use(countCapsule) + 1;
});

Implementation

Capsule<T> capsule<T>(Capsule<T> cap) => cap;