Viewing version 0.0.5. Open the latest package page.

cubit

0.0.5

An experimental Dart library which expose a cubit. A cubit is a reimagined bloc (from package:bloc) which removes events and relies on methods to emit new states instead.

This package is discontinued upstream.

Download archive

Readme

Pub build coverage

WARNING: This is highly experimental

An experimental Dart library which exposes a cubit. A cubit is a reimagined bloc (from package:bloc) which removes events and relies on methods to emit new states instead.

Creating a Cubit

class CounterCubit extends Cubit<int> {
  CounterCubit() : super(initialState: 0);

  void increment() => emit(state + 1);
}

Consuming a Cubit

void main() async {
  final cubit = CounterCubit()
    ..listen(print)
    ..increment();
  await cubit.close();
}

The above code outputs:

1

Dart Versions

  • Dart 2: >= 2.7.0

Maintainers

Changelog

0.0.5

  • feat: allow initialState to be null

0.0.4

  • BREAKING: use named parameter for initialState

0.0.3

  • BREAKING: remove initialState getter and instead require initial state via constructor

0.0.2

  • BREAKING: update emit to be a void function
  • BREAKING: remove artifical wait to guarantee initialState is emitted
  • BREAKING: close drains the internal Stream
  • tests: 100% test coverage

0.0.1

  • feat: initial release

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'cubit:0.0.5'
pubspec.yaml
name: cubit
description: An experimental Dart library which expose a cubit. A cubit is a reimagined bloc (from package:bloc) which removes events and relies on methods to emit new states instead.
repository: https://github.com/felangel/cubit
issue_tracker: https://github.com/felangel/cubit/issues
homepage: https://github.com/felangel/cubit

version: 0.0.5

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  meta: ^1.1.8

dev_dependencies:
  test: ^1.14.6
  test_coverage: ^0.4.1

Version history

VersionPublishedArchiveSHA-256
0.0.1Cached · Upstream SHA-256 matchedDownload079f57b1…226f99
0.0.2Cached · Upstream SHA-256 matchedDownload550fea81…7922f4
0.0.3Cached · Upstream SHA-256 matchedDownloadab88c201…6c8041
0.0.4Cached · Upstream SHA-256 matchedDownloadf4a67d94…bd5876
0.0.5Cached · Upstream SHA-256 matchedDownloadd5696901…51d93a
0.0.6Cached · Upstream SHA-256 matchedDownload73d84229…2abfc8
0.0.7Cached · Upstream SHA-256 matchedDownloadbc21713e…f5615e
0.0.8Cached · Upstream SHA-256 matchedDownload9f5416e3…c307aa
0.0.9Cached · Upstream SHA-256 matchedDownload97d453a5…16439e
0.0.10Cached · Upstream SHA-256 matchedDownloadbc824229…91c69f
0.0.11Cached · Upstream SHA-256 matchedDownloaddad61f71…848bc4
0.0.12Cached · Upstream SHA-256 matchedDownload272e2aaf…c96e94
0.0.13Cached · Upstream SHA-256 matchedDownload60cce409…c6c812
0.0.14Cached · Upstream SHA-256 matchedDownload57389080…ae54d4
0.1.0Cached · Upstream SHA-256 matchedDownload358b6931…b93b64
0.1.1Cached · Upstream SHA-256 matchedDownloaddbc518db…3ccec2
0.1.2Cached · Upstream SHA-256 matchedDownload87a0e33d…bd48b2
0.2.0-dev.1Cached · Upstream SHA-256 matchedDownload3dce5882…766789

Dependencies

meta "^1.1.8"