bloc_network 1.0.1 copy "bloc_network: ^1.0.1" to clipboard
bloc_network: ^1.0.1 copied to clipboard

A dart package to bootstrap using bloc state management for network requests.

example/main.dart

// ignore_for_file: avoid_print

import 'package:bloc_network/bloc_network.dart';

void main() {
  final cubit = CostCubit();
  cubit.stream.listen((state) => print('state changed to: $state'));
  cubit.fetchData();
}

class CostCubit extends QueryCubit<int> {
  @override
  Future<int> repositoryCallback(Object? extra) async {
    // Simulate an asynchronous operation. Typically this would be the place
    // to do something like an HTTP GET request.
    await Future<void>.delayed(const Duration(seconds: 1));
    return 5;
  }
}
6
likes
160
points
3.75k
downloads

Publisher

verified publisherstint.co

Weekly Downloads

A dart package to bootstrap using bloc state management for network requests.

Repository (GitLab)
View/report issues

Topics

#bloc #state-management #network #http

Documentation

API reference

License

MIT (license)

Dependencies

bloc, equatable, meta

More

Packages that depend on bloc_network