ref_out_box 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 52

pub MIT


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

1.1.0 #

add trySetValFn add test add index fix example

1.0.1 #

Fix lib/src/api.dart. (-1 points)

Analysis of lib/src/api.dart reported 2 hints:

line 17 col 39: Avoid types as parameter names.

line 24 col 43: Avoid types as parameter names.

1.0.0 #

Base

example/example.md

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

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  ref_out_box: ^1.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:ref_out_box/ref_out_box.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
5
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:ref_out_box/ref_out_box.dart.

Health suggestions

Format lib/api.dart.

Run dartfmt to format lib/api.dart.

Format lib/index.dart.

Run dartfmt to format lib/index.dart.

Format lib/ref_out_box.dart.

Run dartfmt to format lib/ref_out_box.dart.

Format lib/src/ref_out_box.dart.

Run dartfmt to format lib/src/ref_out_box.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
some ^1.2.2 1.3.0
Dev dependencies
test ^1.6.8