roi peker

cleanup

Reverted GetWidget to original implementation ( to use with `@override`), added docs, renamed "name" to "tag" in `Get.create()` to be consistent with the rest of the GetInstance() methods.
import 'package:get_core/get_core.dart';
import 'get_instance.dart';
extension Inst on GetInterface {
... ... @@ -47,6 +48,7 @@ extension Inst on GetInterface {
/// So, if you call `Get.delete<T>()` the "instance factory" used in this
/// method ([Get.create<T>()]) will be removed, but NOT the instances
/// already created by it.
/// Uses `tag` as the other methods.
///
/// Example:
///
... ... @@ -55,8 +57,8 @@ extension Inst on GetInterface {
/// Repl b = find();
/// print(a==b); (false)```
void create<S>(InstanceBuilderCallback<S> builder,
{String name, bool permanent = true}) =>
GetInstance().create<S>(builder, name: name, permanent: permanent);
{String tag, bool permanent = true}) =>
GetInstance().create<S>(builder, tag: tag, permanent: permanent);
/// Finds a Instance of the required Class <[S]>(or [tag])
/// In the case of using [Get.create()], it will generate an Instance
... ...
... ... @@ -116,11 +116,11 @@ class GetInstance {
/// print(a==b); (false)```
void create<S>(
InstanceBuilderCallback<S> builder, {
String name,
String tag,
bool permanent = true,
}) {
_insert(
isSingleton: false, name: name, builder: builder, permanent: permanent);
isSingleton: false, name: tag, builder: builder, permanent: permanent);
}
/// Injects the Instance [S] builder into the [_singleton] HashMap.
... ...
... ... @@ -11,9 +11,13 @@ import 'package:get_instance/get_instance.dart';
/// }
///
/// class AwesomeView extends GetView<AwesomeController> {
/// /// if you need you can pass the tag for your controller
/// /// in the super constructor.
/// AwesomeView({Key key}):super(key:key, tag:"myControllerTag");
/// /// if you need you can pass the tag for
/// /// Get.find<AwesomeController>(tag:"myTag");
/// @override
/// final String tag = "myTag";
///
/// AwesomeView({Key key}):super(key:key);
///
/// @override
/// Widget build(BuildContext context) {
/// return Container(
... ... @@ -24,9 +28,9 @@ import 'package:get_instance/get_instance.dart';
/// }
///``
abstract class GetView<T> extends StatelessWidget {
const GetView({Key key, this.tag}) : super(key: key);
const GetView({Key key}) : super(key: key);
final String tag;
final String tag = null;
T get controller => GetInstance().find<T>(tag: tag);
... ...