# cubit 0.0.4

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.




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'cubit:0.0.4'
```
Published: 2020-06-15T21:48:55.168879Z
Expected archive SHA-256: f4a67d94ffe75538424b95de122e853e23da053d5ca409bf031d08e73fbd5876
Discontinued upstream.
Available in cache; verification: upstream_checksum
## Direct dependencies
- meta: ^1.1.8

## Package README (untrusted upstream documentation)
<img src="https://raw.githubusercontent.com/felangel/cubit/master/assets/cubit_full.png" height="80" alt="Cubit" />

[![Pub](https://img.shields.io/pub/v/cubit.svg)](https://pub.dev/packages/cubit)
[![build](https://github.com/felangel/cubit/workflows/build/badge.svg)](https://github.com/felangel/cubit/actions)
[![coverage](https://github.com/felangel/cubit/blob/master/packages/cubit/coverage_badge.svg)](https://github.com/felangel/cubit/actions)

**WARNING: This is highly experimental**

An experimental Dart library which exposes a `cubit`. A cubit is a reimagined bloc (from [package:bloc](https://pub.dev/packages/bloc)) which removes events and relies on methods to emit new states instead.

## Creating a Cubit

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

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

## Consuming a Cubit

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

The above code outputs:

```sh
1
```

## Dart Versions

- Dart 2: >= 2.7.0

### Maintainers

- [Felix Angelov](https://github.com/felangel)

## Changelog
# 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







 
