Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2110dfe0
Unverified
Commit
2110dfe0
authored
Nov 06, 2019
by
Jonah Williams
Committed by
GitHub
Nov 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove yield from inherited model (#44233)
parent
41e9ab7d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
inherited_model.dart
packages/flutter/lib/src/widgets/inherited_model.dart
+5
-4
No files found.
packages/flutter/lib/src/widgets/inherited_model.dart
View file @
2110dfe0
...
@@ -119,12 +119,12 @@ abstract class InheritedModel<T> extends InheritedWidget {
...
@@ -119,12 +119,12 @@ abstract class InheritedModel<T> extends InheritedWidget {
// The [result] will be a list of all of context's type T ancestors concluding
// The [result] will be a list of all of context's type T ancestors concluding
// with the one that supports the specified model [aspect].
// with the one that supports the specified model [aspect].
static
Iterable
<
InheritedElement
>
_findModels
<
T
extends
InheritedModel
<
Object
>>(
BuildContext
context
,
Object
aspect
)
sync
*
{
static
void
_findModels
<
T
extends
InheritedModel
<
Object
>>(
BuildContext
context
,
Object
aspect
,
List
<
InheritedElement
>
results
)
{
final
InheritedElement
model
=
context
.
ancestorInheritedElementForWidgetOfExactType
(
T
);
final
InheritedElement
model
=
context
.
ancestorInheritedElementForWidgetOfExactType
(
T
);
if
(
model
==
null
)
if
(
model
==
null
)
return
;
return
;
yield
model
;
results
.
add
(
model
)
;
assert
(
model
.
widget
is
T
);
assert
(
model
.
widget
is
T
);
final
T
modelWidget
=
model
.
widget
;
final
T
modelWidget
=
model
.
widget
;
...
@@ -139,7 +139,7 @@ abstract class InheritedModel<T> extends InheritedWidget {
...
@@ -139,7 +139,7 @@ abstract class InheritedModel<T> extends InheritedWidget {
if
(
modelParent
==
null
)
if
(
modelParent
==
null
)
return
;
return
;
yield
*
_findModels
<
T
>(
modelParent
,
aspect
);
_findModels
<
T
>(
modelParent
,
aspect
,
results
);
}
}
/// Makes [context] dependent on the specified [aspect] of an [InheritedModel]
/// Makes [context] dependent on the specified [aspect] of an [InheritedModel]
...
@@ -163,7 +163,8 @@ abstract class InheritedModel<T> extends InheritedWidget {
...
@@ -163,7 +163,8 @@ abstract class InheritedModel<T> extends InheritedWidget {
// Create a dependency on all of the type T ancestor models up until
// Create a dependency on all of the type T ancestor models up until
// a model is found for which isSupportedAspect(aspect) is true.
// a model is found for which isSupportedAspect(aspect) is true.
final
List
<
InheritedElement
>
models
=
_findModels
<
T
>(
context
,
aspect
).
toList
();
final
List
<
InheritedElement
>
models
=
<
InheritedElement
>[];
_findModels
<
T
>(
context
,
aspect
,
models
);
if
(
models
.
isEmpty
)
{
if
(
models
.
isEmpty
)
{
return
null
;
return
null
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment