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] Allow stream beacons to be start manually #62

Closed jinyus closed 7 months ago

jinyus commented 7 months ago

Description

The beacon will start in the idle state when manualStart is set to true.

test('should not start stream until start() is called', () async {
    final myStream = Stream.periodic(k10ms, (i) => i + 1);
    final myBeacon = Beacon.stream(myStream, manualStart: true);

    expect(myBeacon.isIdle, true);

    myBeacon.start();

    expect(myBeacon.isLoading, true);

    final next = await myBeacon.next();

    expect(next.isData, true);
  });

Type of Change