From 642674a943be7a272df3c8becd9f9d182c240b19 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Sun, 12 Jan 2025 17:43:54 -0600 Subject: [PATCH 1/2] docs(migration): updates for bloc v9 --- docs/src/content/docs/migration.mdx | 77 +++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/docs/src/content/docs/migration.mdx b/docs/src/content/docs/migration.mdx index c7859d1e992..0d30bc50c26 100644 --- a/docs/src/content/docs/migration.mdx +++ b/docs/src/content/docs/migration.mdx @@ -9,8 +9,85 @@ import { Code, Tabs, TabItem } from '@astrojs/starlight/components'; Please refer to the [release log](https://github.com/felangel/bloc/releases) for more information regarding what changed in each release. ::: +## v10.0.0 + +### `package:bloc_test` + +#### ❗✨ Decouple `blocTest` from `BlocBase` + +:::note[What Changed?] +In bloc_test v10.0.0, the `blocTest` API is no longer tightly coupled to `BlocBase`. +::: + +##### Rationale + +`blocTest` should use the core bloc interfaces when possible for increased flexibility and reusability. +Previously this wasn't possible because `BlocBase` implemented `StateStreamableSource` which was not enough for `blocTest` due to the internal dependency on the `emit` API. + +### `package:hydrated_bloc` + +#### ❗✨ Support WebAssembly + +:::note[What Changed?] +In hydrated_bloc v10.0.0, support for compiling to WebAssembly (wasm) was added. +::: + +##### Rationale + +It was previously not possible to compile apps to wasm when using `hydrated_bloc`. In v10.0.0, the package was refactored to allow compiling to wasm. + +**v9.x.x** + +```dart +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + HydratedBloc.storage = await HydratedStorage.build( + storageDirectory: kIsWeb + ? HydratedStorage.webStorageDirectory + : await getTemporaryDirectory(), + ); + runApp(App()); +} +``` + +**v10.x.x** + +```dart +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + HydratedBloc.storage = await HydratedStorage.build( + storageDirectory: kIsWeb + ? HydratedStorageDirectory.web + : HydratedStorageDirectory((await getTemporaryDirectory()).path), + ); + runApp(const App()); +} +``` + ## v9.0.0 +### `package:bloc` + +#### ❗🧹 Remove Deprecated APIs + +:::note[What Changed?] +In bloc v9.0.0, all previously deprecated APIs were removed. +::: + +#### ❗✨ Introduce new `EmittableStateStreamableSource` Interface + +:::note[What Changed?] +In bloc v9.0.0, a new core interface `EmittableStateStreamableSource` was introduced. +::: + +##### Rationale + +`package:bloc_test` was previously tightly coupled to `BlocBase`. The `EmittableStateStreamableSource` interface was introduced in order to allow `blocTest` to be decoupled from the `BlocBase` concrete implementation. + +##### Summary + +- `BlocOverrides` removed in favor of `Bloc.observer` and `Bloc.transformer` + ### `package:hydrated_bloc` #### ✨ Reintroduce `HydratedBloc.storage` API From 24e2152e7bc571015637bc075b6ff70dc48723b5 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Sun, 12 Jan 2025 17:45:23 -0600 Subject: [PATCH 2/2] fix; --- docs/src/content/docs/migration.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/content/docs/migration.mdx b/docs/src/content/docs/migration.mdx index 0d30bc50c26..645b0883cf4 100644 --- a/docs/src/content/docs/migration.mdx +++ b/docs/src/content/docs/migration.mdx @@ -74,6 +74,10 @@ void main() async { In bloc v9.0.0, all previously deprecated APIs were removed. ::: +##### Summary + +- `BlocOverrides` removed in favor of `Bloc.observer` and `Bloc.transformer` + #### ❗✨ Introduce new `EmittableStateStreamableSource` Interface :::note[What Changed?] @@ -84,10 +88,6 @@ In bloc v9.0.0, a new core interface `EmittableStateStreamableSource` was introd `package:bloc_test` was previously tightly coupled to `BlocBase`. The `EmittableStateStreamableSource` interface was introduced in order to allow `blocTest` to be decoupled from the `BlocBase` concrete implementation. -##### Summary - -- `BlocOverrides` removed in favor of `Bloc.observer` and `Bloc.transformer` - ### `package:hydrated_bloc` #### ✨ Reintroduce `HydratedBloc.storage` API