Showing
1 changed file
with
14 additions
and
6 deletions
@@ -37,6 +37,13 @@ The methods and it's configurable parameters are: | @@ -37,6 +37,13 @@ The methods and it's configurable parameters are: | ||
37 | The most common way of insert a dependency. Good for the controllers of your views for example. | 37 | The most common way of insert a dependency. Good for the controllers of your views for example. |
38 | 38 | ||
39 | ```dart | 39 | ```dart |
40 | +Get.put<SomeClass>(SomeClass()); | ||
41 | +Get.put<LoginController>(LoginController(), permanent: true); | ||
42 | +Get.put<ListItemController>(ListItemController, tag: "some unique string"); | ||
43 | +``` | ||
44 | + | ||
45 | +This is all options you can set when using put: | ||
46 | +```dart | ||
40 | Get.put<S>( | 47 | Get.put<S>( |
41 | // mandatory: the class that you want to get to save, like a controller or anything | 48 | // mandatory: the class that you want to get to save, like a controller or anything |
42 | // note: "S" means that it can be a class of any type | 49 | // note: "S" means that it can be a class of any type |
@@ -63,10 +70,6 @@ Get.put<S>( | @@ -63,10 +70,6 @@ Get.put<S>( | ||
63 | // this one is not commonly used | 70 | // this one is not commonly used |
64 | InstanceBuilderCallback<S> builder, | 71 | InstanceBuilderCallback<S> builder, |
65 | ) | 72 | ) |
66 | - | ||
67 | -// Example: | ||
68 | - | ||
69 | -Get.put<LoginController>(LoginController(), permanent: true) | ||
70 | ``` | 73 | ``` |
71 | 74 | ||
72 | ### Get.lazyPut | 75 | ### Get.lazyPut |
@@ -108,8 +111,6 @@ Get.lazyPut<S>( | @@ -108,8 +111,6 @@ Get.lazyPut<S>( | ||
108 | ``` | 111 | ``` |
109 | 112 | ||
110 | ### Get.putAsync | 113 | ### Get.putAsync |
111 | - | ||
112 | -Since `Get.put()` does not support async methods/classes, you need to use Get.putAsync. The way of declare is equal to Get.lazyPut | ||
113 | If you want to register an asynchronous instance, you can use `Get.putAsync`: | 114 | If you want to register an asynchronous instance, you can use `Get.putAsync`: |
114 | 115 | ||
115 | ```dart | 116 | ```dart |
@@ -145,6 +146,13 @@ Get.putAsync<YourAsyncClass>( () async => await YourAsyncClass() ) | @@ -145,6 +146,13 @@ Get.putAsync<YourAsyncClass>( () async => await YourAsyncClass() ) | ||
145 | 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 | 146 | 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 |
146 | 147 | ||
147 | ```dart | 148 | ```dart |
149 | +Get.Create<SomeClass>(() => SomeClass()); | ||
150 | +Get.Create<LoginController>(() => LoginController()); | ||
151 | +``` | ||
152 | + | ||
153 | +This is all options you can set when using create: | ||
154 | + | ||
155 | +```dart | ||
148 | Get.create<S>( | 156 | Get.create<S>( |
149 | // required: a function that returns a class that will be "fabricated" every | 157 | // required: a function that returns a class that will be "fabricated" every |
150 | // time `Get.find()` is called | 158 | // time `Get.find()` is called |
-
Please register or login to post a comment