Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Nipodemos
2020-09-01 16:01:08 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e722110fd8118049b4c05c4eab73d66a0635bbc0
e722110f
1 parent
f7e2d213
a little bit more refactor
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
documentation/en_US/dependency_management.md
documentation/en_US/dependency_management.md
View file @
e722110
...
...
@@ -37,6 +37,13 @@ The methods and it's configurable parameters are:
The most common way of insert a dependency. Good for the controllers of your views for example.
```
dart
Get
.
put
<
SomeClass
>(
SomeClass
());
Get
.
put
<
LoginController
>(
LoginController
(),
permanent:
true
);
Get
.
put
<
ListItemController
>(
ListItemController
,
tag:
"some unique string"
);
```
This is all options you can set when using put:
```
dart
Get
.
put
<
S
>(
// mandatory: the class that you want to get to save, like a controller or anything
// note: "S" means that it can be a class of any type
...
...
@@ -63,10 +70,6 @@ Get.put<S>(
// this one is not commonly used
InstanceBuilderCallback
<
S
>
builder
,
)
// Example:
Get
.
put
<
LoginController
>(
LoginController
(),
permanent:
true
)
```
### Get.lazyPut
...
...
@@ -108,8 +111,6 @@ Get.lazyPut<S>(
```
### Get.putAsync
Since
`Get.put()`
does not support async methods/classes, you need to use Get.putAsync. The way of declare is equal to Get.lazyPut
If you want to register an asynchronous instance, you can use
`Get.putAsync`
:
```
dart
...
...
@@ -145,6 +146,13 @@ Get.putAsync<YourAsyncClass>( () async => await YourAsyncClass() )
This one is tricky. A detailed explanation of what this is and the differences between the other one can be found on
[
Differences between methods:
](
#differences-between-methods
)
section
```
dart
Get
.
Create
<
SomeClass
>(()
=>
SomeClass
());
Get
.
Create
<
LoginController
>(()
=>
LoginController
());
```
This is all options you can set when using create:
```
dart
Get
.
create
<
S
>(
// required: a function that returns a class that will be "fabricated" every
// time `Get.find()` is called
...
...
Please
register
or
login
to post a comment