ref_out_box 1.1.0 ref_out_box: ^1.1.0 copied to clipboard
Wrapping values so that they can be passed by reference, like c#'s ref out
Wrapping values so that they can be passed by reference, like c#'s ref out
Example #
void tryDoSome(Out<bool> out) {
trySetVal(out, true);
}
final out = Out<bool>();
tryDoSome(out);
out.val; // true
void addRef(Ref<int> ref) {
tryChangeVal(ref, (val) => val + 1);
}
final ref = Ref(1);
addRef(ref);
addRef(ref);
ref.val; // 3