p-hatan/ mirror

pub repository

mirror.p-hatan.com

cubit

0.0.10

Cubit is a lightweight state management solution. It is a subset of the bloc package that does not rely on events and instead uses methods to emit new states.

This package is discontinued upstream.

Download archive

Readme

Pub build coverage Star on GitHub License: MIT


WARNING: This is highly experimental

Cubit is a lightweight state management solution. It is a subset of the bloc package that does not rely on events and instead uses methods to emit new states.

Every cubit requires an initial state which will be the state of the cubit before emit has been called. The current state of a cubit can be accessed via the state getter.

Creating a Cubit

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

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

Consuming a Cubit

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

Dart Versions

  • Dart 2: >= 2.7.0

Maintainers

Changelog

0.0.10

  • docs: various documentation updates

0.0.9

  • docs: documentation and logo updates

0.0.8

  • BREAKING: revert named initialState parameter (related issue)
  • docs: minor logo updates

0.0.7

  • feat: add onTransition to cubit
  • feat: Cubit extends CubitStream

0.0.6

  • BREAKING: ignore duplicate states

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.com
flutter pub add cubit
pubspec.yaml
name: cubit
description: Cubit is a lightweight state management solution. It is a subset of the bloc package that does not rely on events and instead uses methods to emit new states.
repository: https://github.com/felangel/cubit
issue_tracker: https://github.com/felangel/cubit/issues
homepage: https://github.com/felangel/cubit

version: 0.0.10

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.12020-06-04T05:55:57.727961ZDownload079f57b12178d6f095abc9c95630394748d65da39be0f9cda37f0a64a1226f99
0.0.22020-06-06T04:32:19.230635ZDownload550fea81678f0ef851609af4cb392dd6d8ba536a68af425ab4ffa7c3df7922f4
0.0.32020-06-07T06:17:57.682631ZDownloadab88c201363a68f338b53d59f176103ce0f985ab4a3483a29d568e3dcb6c8041
0.0.42020-06-15T21:48:55.168879ZDownloadf4a67d94ffe75538424b95de122e853e23da053d5ca409bf031d08e73fbd5876
0.0.52020-06-16T05:21:19.350436ZDownloadd56969016343cbdab0379768a98f65559ba6c67c9441c1f931ad6cf7e451d93a
0.0.62020-06-16T19:52:12.134212ZDownload73d842299307a6c6787328387bcbff5a8e36a2c5ca66a6402fcb0750e62abfc8
0.0.72020-06-19T19:24:45.452869ZDownloadbc21713e8d86bb85e44108e3a0a589d1da32033d8c750ba3bbf049c8a2f5615e
0.0.82020-06-22T17:43:32.729350ZDownload9f5416e34fafce735563d43ce099c50f26bec23ca9b3b12942f0fe861ac307aa
0.0.92020-06-23T16:55:21.670738ZDownload97d453a53f6a956ded105adb7b3f21256715cb5c6c5f3273c3cf6e61f816439e
0.0.102020-06-23T19:01:56.870357ZDownloadbc8242294ac4df6262e17910d2543ab7d3f05beff848c0505212c496a791c69f
0.0.112020-06-23T22:34:30.083919ZDownloaddad61f7109f1408f74193149bd6ab67b2761ba7b43892a08fbba8b4e2f848bc4
0.0.122020-06-23T22:41:43.875858ZDownload272e2aaf634f651d50d94ba28a3968d811d79346e4bfed810e24a84973c96e94
0.0.132020-06-23T22:43:29.163348ZDownload60cce409da6a660befd333f582d26957a022df39e5401419ce9ce07139c6c812
0.0.142020-06-27T01:48:04.045972ZDownload573890801c38ca57530032f464ad8d5a63fe6a75d48854911f1e6572d1ae54d4
0.1.02020-07-01T15:26:05.706024ZDownload358b693136e3280e0d8b2ac62fb9c150b590b9b2664d706c37a682ce42b93b64
0.1.12020-07-05T22:27:23.071429ZDownloaddbc518db887ad8c2bca8ccf1026580f1545424930df8d698016a2497b53ccec2
0.1.22020-07-06T00:10:54.737736ZDownload87a0e33da05fbfcdd43aedb9f3156f04523f0624ab3a3bd06e8b9b67fdbd48b2
0.2.0-dev.12020-07-06T04:31:26.968656ZDownload3dce5882a2f83f93ec7ef95465046d295dd4d2e775460f4e158d5f9f50766789

Dependencies

meta "^1.1.8"