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
Aryan More
2023-07-03 16:17:17 +0530
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-07-03 16:17:17 +0530
Commit
b677cc61cd948f65648413b803ce7eb16b8abf19
b677cc61
1 parent
8cf8df06
Update extension_instance.dart
Implemented findOrNull method
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
lib/get_instance/src/extension_instance.dart
lib/get_instance/src/extension_instance.dart
View file @
b677cc6
...
...
@@ -298,6 +298,17 @@ extension Inst on GetInterface {
}
}
/// The findOrNull method will return the instance if it is registered;
/// otherwise, it will return null.
S
?
findOrNull
<
S
>({
String
?
tag
})
{
if
(
isRegistered
<
S
>(
tag:
tag
))
{
return
find
<
S
>(
tag:
tag
);
}
return
null
;
}
/// Replace a parent instance of a class in dependency management
/// with a [child] instance
/// - [tag] optional, if you use a [tag] to register the Instance.
...
...
Please
register
or
login
to post a comment