Skip to content

Commit

Permalink
chore: update logo (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: Manuel Plavsic <[email protected]>
  • Loading branch information
nank1ro and manuel-plavsic authored Jan 29, 2025
1 parent 545b40c commit 88edcdd
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 69 deletions.
37 changes: 16 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

# Disco

<img src="https://raw.githubusercontent.com/our-creativity/disco/main/assets/disco.jpeg" height="400">

---

A modern, convenient, simple and safe way to do scoped dependency injection in Flutter.

For learning how to use [Disco](https://github.com/our-creativity/disco), see its documentation: >>> https://disco.mariuti.com <<<
Expand All @@ -25,29 +21,28 @@ For learning how to use [Disco](https://github.com/our-creativity/disco), see it

## Usage

### Creating a provider
1. Create a provider

```dart
final modelProvider = Provider((context) => Model());
```
```dart
final modelProvider = Provider((context) => Model());
```
### Providing a provider
2. Scope/provide the provider
```dart
ProviderScope(
providers: [modelProvider],
child: MyWidget(),
)
```
```dart
ProviderScope(
providers: [modelProvider],
child: MyWidget(),
)
```
### Retrieving a provider
```dart
final model = modelProvider.of(context);
```
3. Inject the provider (within the above `ProviderScope`'s subtree)
You can retrieve a provider from any widget in the subtree of the `ProviderScope` where the provider has been provided.
```dart
final model = modelProvider.of(context);
```
### Examples
## Examples
There are multiple examples on the repository:
Expand Down
2 changes: 1 addition & 1 deletion docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default defineConfig({
tag: 'meta',
attrs: {
property: 'og:image',
content: 'https://disco.mariuti.com/disco.jpeg',
content: 'https://disco.mariuti.com/disco.png',
}
}],
sidebar: [
Expand Down
Binary file removed docs/public/disco.jpeg
Binary file not shown.
Binary file added docs/public/disco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 17 additions & 20 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,32 @@ title: Disco
description: Official documentation for Disco, a modern and simple library for scoped dependency injection in Flutter.
---

<img src="disco.jpeg" alt="disco image" width="500" style="border: 1px solid grey;"/>

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
1. Create a provider

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

### Providing a provider
2. Scope/provide the provider

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

### Retrieving a provider
```dart
final model = modelProvider.of(context);
```
3. Inject the provider (within the above `ProviderScope`'s subtree)

You can retrieve a provider from any widget in the subtree of the `ProviderScope` where the provider has been provided.
```dart
final model = modelProvider.of(context);
```

To get straight to the point, pros and cons are summarized below.
## Trade-offs

### Pros

Expand Down Expand Up @@ -72,6 +69,6 @@ In Disco's defense regarding the last point:
- Disco providers also have a `maybeOf(context)` method, which can help if the presence of a provider cannot be guaranteed.
- The throwable includes precise information in its stack trace to deduce the missing provider: filepath, line and column.

## Keep in mind: trade-offs
### Keep in mind

As the <a href="/authors">authors of Disco</a>, we believe this to be the most effective strategy for DI in Flutter. However, every solution has trade-offs. You can limit the impact of these trade-offs by running tests, doing code reviews, and following other crucial practices.
4 changes: 4 additions & 0 deletions packages/disco/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0+1

- **CHORE**: Update README.md

## 1.0.0

- Added comprehensive documentation (see [Disco homepage](https://disco.mariuti.com)) with numerous examples.
Expand Down
35 changes: 15 additions & 20 deletions packages/disco/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

# Disco

<img src="https://raw.githubusercontent.com/our-creativity/disco/main/assets/disco.jpeg" height="400">

---

A modern, convenient, simple and safe way to do scoped dependency injection in Flutter.

For learning how to use [Disco](https://github.com/our-creativity/disco), see its documentation: >>> https://disco.mariuti.com <<<
Expand All @@ -25,27 +21,26 @@ For learning how to use [Disco](https://github.com/our-creativity/disco), see it

## Usage

### Creating a provider
1. Create a provider

```dart
final modelProvider = Provider((context) => Model());
```
```dart
final modelProvider = Provider((context) => Model());
```
### Providing a provider
2. Scope/provide the provider
```dart
ProviderScope(
providers: [modelProvider],
child: MyWidget(),
)
```
```dart
ProviderScope(
providers: [modelProvider],
child: MyWidget(),
)
```
### Retrieving a provider
```dart
final model = modelProvider.of(context);
```
3. Inject the provider (within the above `ProviderScope`'s subtree)
You can retrieve a provider from any widget in the subtree of the `ProviderScope` where the provider has been provided.
```dart
final model = modelProvider.of(context);
```
### Examples
Expand Down
6 changes: 0 additions & 6 deletions packages/disco/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'package:disco/disco.dart';
import 'package:flutter/material.dart';

/// ---
/// Model
/// ---
abstract class Model extends ChangeNotifier {
void incrementCounter();

Expand All @@ -23,9 +20,6 @@ class ModelImplementation extends Model {
}
}

/// ---
/// Provider
/// ---
final modelProvider = Provider<Model>((context) => ModelImplementation());

void main() {
Expand Down
2 changes: 1 addition & 1 deletion packages/disco/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: disco
description: A Flutter library bringing a new concept of scoped providers for dependency injection, which are independent of any specific state management solution.
version: 1.0.0
version: 1.0.0+1
repository: https://github.com/our-creativity/disco
homepage: https://disco.mariuti.com
documentation: https://disco.mariuti.com
Expand Down

0 comments on commit 88edcdd

Please sign in to comment.