Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/docs/cross-spawn-7.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanpodila authored Dec 15, 2024
2 parents e439783 + 1f40380 commit 50db29a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
19 changes: 19 additions & 0 deletions docs/docs/api/observable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>` 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
Expand Down
8 changes: 4 additions & 4 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 50db29a

Please sign in to comment.