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
Jermaine McFarlane
2021-07-15 16:17:05 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
53dc924fbfd69743fbfd098e5c969ffa579e8531
53dc924f
1 parent
23a4890e
ensure permanent instances are replaced
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
lib/get_instance/src/extension_instance.dart
lib/get_instance/src/extension_instance.dart
View file @
53dc924
...
...
@@ -131,8 +131,11 @@ extension Inst on GetInterface {
/// Replace a parent instance of a class in dependency management
/// with a [child] instance
void
replace
<
P
,
C
extends
P
>(
C
child
,
{
String
?
tag
,
bool
permanent
=
false
})
{
delete
<
P
>();
/// - [tag] optional, if you use a [tag] to register the Instance.
void
replace
<
P
,
C
extends
P
>(
C
child
,
{
String
?
tag
})
{
final
info
=
GetInstance
().
getInstanceInfo
<
P
>(
tag:
tag
);
final
permanent
=
(
info
.
isPermanent
??
false
);
delete
<
P
>(
tag:
tag
,
force:
permanent
);
// ignore: unnecessary_cast
put
(
child
as
P
,
tag:
tag
,
permanent:
permanent
);
}
...
...
Please
register
or
login
to post a comment