Skip to content

Commit 89e9dac

Browse files
authored
Merge pull request #94 from Bryanx/patch-1
Some typo's
2 parents ad202db + d492946 commit 89e9dac

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Please see [Synchronizing asynchronous initializations of Singletons](#synchroni
1414

1515
## Why GetIt
1616

17-
As your App grows, at some point you you will need to put your app's logic in classes that are separated from your Widgets. Keeping your widgets from having direct dependencies makes your code better organized and easier to test and maintain.
17+
As your App grows, at some point you will need to put your app's logic in classes that are separated from your Widgets. Keeping your widgets from having direct dependencies makes your code better organized and easier to test and maintain.
1818
But now you need a way to access these objects from your UI code. When I came to Flutter from the .Net world, the only way to do this was the use of InheritedWidgets. I found the way to use them by wrapping them in a StatefulWidget; quite cumbersome and has problems working consistently. Also:
1919

2020
* I missed the ability to easily switch the implementation for a mocked version without changing the UI.
@@ -28,8 +28,8 @@ Accessing an object from anywhere in an App can be done by other ways, but:
2828

2929
As I was used to use the Service Locator _Splat_ from .Net, I decided to port it to Dart. Since then, more features have been added.
3030

31-
>If you are not familiar with the concept of Service Locators, its a way to decouple the interface (abstract base class) from a concrete implementation, and at the same time allows to access the concrete implementation from everywhere in your App over the interface.
32-
> I can only highly recommend to read this classic article by from Martin Fowler [Inversion of Control Containers and the Dependency Injection pattern](https://martinfowler.com/articles/injection.html)
31+
>If you are not familiar with the concept of Service Locators, it's a way to decouple the interface (abstract base class) from a concrete implementation, and at the same time allows to access the concrete implementation from everywhere in your App over the interface.
32+
> I can only highly recommend to read this classic article by from Martin Fowler [Inversion of Control Containers and the Dependency Injection pattern](https://martinfowler.com/articles/injection.html).
3333
3434
GetIt is:
3535
* Extremely fast (O(1))
@@ -222,7 +222,7 @@ Future<T> getAsync<T>([String instanceName]);
222222

223223
## Asynchronous Singletons
224224

225-
Additionally you can register asynchronous Singletons which means Singletons that have an initialisation that requires async function calls. To be able to control such asynchronous start-up behaviour GetIt supports mechanisms to ensure the correct initialization sequence.
225+
Additionally you can register asynchronous Singletons which means Singletons that have an initialization that requires async function calls. To be able to control such asynchronous start-up behaviour GetIt supports mechanisms to ensure the correct initialization sequence.
226226

227227

228228
You create an Singleton with an asynchronous creation function
@@ -421,8 +421,8 @@ These parameters are passed as `dynamics` (otherwise I would have had add more g
421421
### Unit Tests
422422
When you are writing unit tests with GetIt in your App you have two possibilities:
423423

424-
* register all the Objects you need inside your unit Tests so that GetIt can provide its objects to the objects tat you are testing
425-
* pass your dependent objects into the constructor of you test objects like:
424+
* Register all the Objects you need inside your unit Tests so that GetIt can provide its objects to the objects that you are testing.
425+
* Pass your dependent objects into the constructor of your test objects like:
426426

427427
```Dart
428428
GetIt getIt = GetIt.instance;
@@ -438,10 +438,10 @@ class UserManager {
438438
}
439439
```
440440

441-
This way you don't need to pass them in the `AppModel` and `dbService` inside your App but you can pass them(or a mocked version) in your Unit tests
441+
This way you don't need to pass them in the `AppModel` and `dbService` inside your App but you can pass them(or a mocked version) in your Unit tests.
442442

443443
### Integration Tests
444-
If you have a mocked version of a Service, you can easily switch between that and the real one based on a some flag:
444+
If you have a mocked version of a Service, you can easily switch between that and the real one based on a flag:
445445

446446
```Dart
447447
if (testing) {
@@ -455,7 +455,7 @@ If you have a mocked version of a Service, you can easily switch between that an
455455

456456
### Named registration
457457

458-
**DON'T USE THIS IF UNLESS REALLY KNOW WHAT YOU ARE DOING!!!**
458+
**DON'T USE THIS UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!!!**
459459

460460
This should be your last resort as you can lose type safety.
461461

0 commit comments

Comments
 (0)