Skip to content

Commit

Permalink
docs: enhancement (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
nank1ro authored Jan 29, 2025
1 parent 1e1b148 commit 545b40c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
6 changes: 0 additions & 6 deletions docs/src/content/docs/examples/basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ In particular, it shows how to create a provider, how to scope it, how to use it
import 'package:disco/disco.dart';
import 'package:flutter/material.dart';
/// ---
/// Model
/// ---
abstract class Model extends ChangeNotifier {
void incrementCounter();
Expand All @@ -35,9 +32,6 @@ class ModelImplementation extends Model {
}
}
/// ---
/// Provider
/// ---
final modelProvider = Provider<Model>((context) => ModelImplementation());
void main() {
Expand Down
24 changes: 24 additions & 0 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@ description: Official documentation for Disco, a modern and simple library for s

Disco is a library introducing a new concept of providers that operate differently from those already present in the Flutter ecosystem. It was developed to overcome the challenges and limitations in the context of dependency injection.

## Usage

### Creating a provider

```dart
final modelProvider = Provider((context) => Model());
```

### Providing a provider

```dart
ProviderScope(
providers: [modelProvider],
child: MyWidget(),
)
```

### Retrieving a provider
```dart
final model = modelProvider.of(context);
```

You can retrieve a provider from any widget in the subtree of the `ProviderScope` where the provider has been provided.

To get straight to the point, pros and cons are summarized below.

### Pros
Expand Down

0 comments on commit 545b40c

Please sign in to comment.