jinyus / dart_beacon

A reactive primitive (signals) and state management library for dart and flutter
https://pub.dev/packages/state_beacon
28 stars 2 forks source link

[Feat] Add map to chain methods #68

Closed jinyus closed 5 months ago

jinyus commented 5 months ago

Description

final count = Beacon.writable(10);
final mapped = count.map((value) => value * 2);

expect(mapped.value, 20);

count.value = 20;

expect(count.value, 20);
expect(mapped.value, 40);
final stream = Stream.periodic(k1ms, (i) => i).take(5);
final beacon = stream
        .toRawBeacon(isLazy: true)
        .filter(filter: (_, n) => n.isEven)
        .map((v) => v + 1)
        .throttle(duration: k1ms);

await expectLater(beacon.stream, emitsInOrder([1, 3, 5]));

Type of Change

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (96fbc9c) 100.00% compared to head (bfce2e6) 100.00%. Report is 11 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #68 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 34 34 Lines 957 995 +38 ========================================= + Hits 957 995 +38 ``` | [Flag](https://app.codecov.io/gh/jinyus/dart_beacon/pull/68/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jinyus) | Coverage Ξ” | | |---|---|---| | [unittests](https://app.codecov.io/gh/jinyus/dart_beacon/pull/68/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jinyus) | `100.00% <100.00%> (ΓΈ)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jinyus#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.