diff --git a/docs/docs/api/observable.mdx b/docs/docs/api/observable.mdx index 6bc0d21a..eeb1bcac 100644 --- a/docs/docs/api/observable.mdx +++ b/docs/docs/api/observable.mdx @@ -72,6 +72,25 @@ abstract class _Todo with Store { } ``` +:::info Reactive Extensions + +You can convert plain `int`, 'double', `bool`, and `String` literals into +an observable version with the `.obs()` extension method. For example: + +```dart +var name = ''.obs(); // infers ObservableString +var counter = 0.obs(); // infers ObservableInt +``` + +You can toggle an internal value of `Observable` with `.toggle()`: + +```dart +var lights = true.obs(); +lights.toggle(); // now lights.value is false +``` + +::: + ## Readonly Generally speaking you want two things in your stores: reactive fields and diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index 7f3ab2d7..06dde605 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -3483,8 +3483,8 @@ packages: mz@2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} - nanoid@3.3.7: - resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + nanoid@3.3.8: + resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true @@ -9615,7 +9615,7 @@ snapshots: object-assign: 4.1.1 thenify-all: 1.6.0 - nanoid@3.3.7: {} + nanoid@3.3.8: {} negotiator@0.6.3: {} @@ -10081,7 +10081,7 @@ snapshots: postcss@8.4.38: dependencies: - nanoid: 3.3.7 + nanoid: 3.3.8 picocolors: 1.0.0 source-map-js: 1.2.0