sealed_flutter_bloc
sealed_unions를 통합하는 flutter_bloc 상태 관리 확장 기능입니다.
- 스타
- 78
- 포크
- 12
- 최근 푸시(UTC)
- 2024. 3. 24.
- 프로젝트 상태
- 보관됨
원본 README
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
⚠️ This package has been discontinued in favor of the built-in sealed class modifier introduced in Dart 3.0. ⚠️

flutter_bloc meets sealed_unions
Sponsors
Our top sponsors are shown below! [Become a Sponsor]
|
|
![]() Try the Flutter Chat Tutorial 💬 |
|
|
|
Quick Start
Extend UnionNImpl
class MyState extends Union4Impl<Initial, Loading, Success, Failure> {
static final unions = const Quartet<Initial, Loading, Success, Failure>();
MyState._(Union4<Initial, Loading, Success, Failure> union) : super(union);
factory MyState.initial() => MyState._(unions.first(Initial()));
factory MyState.loading() => MyState._(unions.second(Loading()));
factory MyState.success({required String data}) =>
MyState._(unions.third(Success(data: data)));
factory MyState.failure({required String error}) =>
MyState._(unions.fourth(Failure(error: error)));
}
class Initial {}
class Loading {}
class Success {
final String data;
Success({required this.data});
}
class Failure {
String error;
Failure({required this.error});
}
Use SealedBlocBuilder
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SealedBlocBuilder4<MyBloc, MyState, Initial, Loading, Success,
Failure>(
builder: (context, states) => states(
(initial) => Text('Initial'),
(loading) => CircularProgressIndicator(),
(success) => Text('Success: ${success.data}'),
(failure) => Text('Failure: ${failure.error}'),
),
);
}
}
Additional Examples
More examples can be found at sealed_flutter_bloc_samples.
언어DartCMakeC++HTMLSwiftCKotlinObjective-C
분류
사용 중인 의존성
의존성 목록 5 개
- bloc
^8.0.0 - flutter
{"sdk":"flutter"} - flutter_bloc
^8.0.0 - sealed_unions
^3.0.3+1 - flutter_test개발 의존성
{"sdk":"flutter"}
프로젝트에 맞는 저장소를 선택하려면?
사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
- 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
- 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
- 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.
출처 및 관리
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗



