added tests, removed API (#69620)
This commit is contained in:
committed by
GitHub
parent
ddc0dc13ae
commit
535392bfd5
@@ -11,6 +11,149 @@
|
||||
version: 1
|
||||
transforms:
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/44189.
|
||||
- title: 'Rename to dependOnInheritedElement'
|
||||
date: 2019-11-22
|
||||
element:
|
||||
uris: [ 'material.dart', 'cupertino.dart', 'widgets.dart' ]
|
||||
inClass: 'BuildContext'
|
||||
method: 'inheritFromElement'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'dependOnInheritedElement'
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/44189.
|
||||
- title: 'Migrate to dependOnInheritedWidgetOfExactType'
|
||||
date: 2019-11-22
|
||||
element:
|
||||
uris: [ 'material.dart', 'cupertino.dart', 'widgets.dart' ]
|
||||
inClass: 'BuildContext'
|
||||
method: 'inheritFromWidgetOfExactType'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'dependOnInheritedWidgetOfExactType'
|
||||
- kind: 'removeParameter'
|
||||
index: 0
|
||||
- kind: 'addTypeParameter'
|
||||
index: 0
|
||||
name: 'T'
|
||||
argumentValue:
|
||||
expression: '{% type %}'
|
||||
variables:
|
||||
type:
|
||||
kind: fragment
|
||||
value: 'arguments[0]'
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/44189.
|
||||
- title: 'Migrate to getElementForInheritedWidgetOfExactType'
|
||||
date: 2019-11-22
|
||||
element:
|
||||
uris: [ 'material.dart', 'cupertino.dart', 'widgets.dart' ]
|
||||
inClass: 'BuildContext'
|
||||
method: 'ancestorInheritedElementForWidgetOfExactType'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'getElementForInheritedWidgetOfExactType'
|
||||
- kind: 'removeParameter'
|
||||
index: 0
|
||||
- kind: 'addTypeParameter'
|
||||
index: 0
|
||||
name: 'T'
|
||||
argumentValue:
|
||||
expression: '{% type %}'
|
||||
variables:
|
||||
type:
|
||||
kind: fragment
|
||||
value: 'arguments[0]'
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/44189.
|
||||
- title: 'Migrate to findAncestorWidgetOfExactType'
|
||||
date: 2019-11-22
|
||||
element:
|
||||
uris: [ 'material.dart', 'cupertino.dart', 'widgets.dart' ]
|
||||
inClass: 'BuildContext'
|
||||
method: 'ancestorWidgetOfExactType'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'findAncestorWidgetOfExactType'
|
||||
- kind: 'removeParameter'
|
||||
index: 0
|
||||
- kind: 'addTypeParameter'
|
||||
index: 0
|
||||
name: 'T'
|
||||
argumentValue:
|
||||
expression: '{% type %}'
|
||||
variables:
|
||||
type:
|
||||
kind: fragment
|
||||
value: 'arguments[0]'
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/44189.
|
||||
- title: 'Migrate to findAncestorStateOfType'
|
||||
date: 2019-11-22
|
||||
element:
|
||||
uris: [ 'material.dart', 'cupertino.dart', 'widgets.dart' ]
|
||||
inClass: 'BuildContext'
|
||||
method: 'ancestorStateOfType'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'findAncestorStateOfType'
|
||||
- kind: 'removeParameter'
|
||||
index: 0
|
||||
- kind: 'addTypeParameter'
|
||||
index: 0
|
||||
name: 'T'
|
||||
argumentValue:
|
||||
expression: '{% type %}'
|
||||
variables:
|
||||
type:
|
||||
kind: fragment
|
||||
value: 'arguments[0].typeArguments[0]'
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/44189.
|
||||
- title: 'Migrate to rootAncestorStateOfType'
|
||||
date: 2019-11-22
|
||||
element:
|
||||
uris: [ 'material.dart', 'cupertino.dart', 'widgets.dart' ]
|
||||
inClass: 'BuildContext'
|
||||
method: 'rootAncestorStateOfType'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'findRootAncestorStateOfType'
|
||||
- kind: 'removeParameter'
|
||||
index: 0
|
||||
- kind: 'addTypeParameter'
|
||||
index: 0
|
||||
name: 'T'
|
||||
argumentValue:
|
||||
expression: '{% type %}'
|
||||
variables:
|
||||
type:
|
||||
kind: fragment
|
||||
value: 'arguments[0].typeArguments[0]'
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/44189.
|
||||
- title: 'Migrate to ancestorRenderObjectOfType'
|
||||
date: 2019-11-22
|
||||
element:
|
||||
uris: [ 'material.dart', 'cupertino.dart', 'widgets.dart' ]
|
||||
inClass: 'BuildContext'
|
||||
method: 'ancestorRenderObjectOfType'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'findAncestorRenderObjectOfType'
|
||||
- kind: 'removeParameter'
|
||||
index: 0
|
||||
- kind: 'addTypeParameter'
|
||||
index: 0
|
||||
name: 'T'
|
||||
argumentValue:
|
||||
expression: '{% type %}'
|
||||
variables:
|
||||
type:
|
||||
kind: fragment
|
||||
value: 'arguments[0].typeArguments[0]'
|
||||
|
||||
# Changes made in https://github.com/flutter/flutter/pull/45941
|
||||
- title: 'Rename to deferFirstFrame'
|
||||
date: 2020-12-23
|
||||
|
||||
@@ -2233,17 +2233,6 @@ abstract class BuildContext {
|
||||
/// render object is usually short.
|
||||
Size? get size;
|
||||
|
||||
/// Registers this build context with [ancestor] such that when
|
||||
/// [ancestor]'s widget changes this build context is rebuilt.
|
||||
///
|
||||
/// This method is deprecated. Please use [dependOnInheritedElement] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use dependOnInheritedElement instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
InheritedWidget inheritFromElement(InheritedElement ancestor, { Object aspect });
|
||||
|
||||
/// Registers this build context with [ancestor] such that when
|
||||
/// [ancestor]'s widget changes this build context is rebuilt.
|
||||
///
|
||||
@@ -2257,20 +2246,6 @@ abstract class BuildContext {
|
||||
/// be called apply to this method as well.
|
||||
InheritedWidget dependOnInheritedElement(InheritedElement ancestor, { Object aspect });
|
||||
|
||||
/// Obtains the nearest widget of the given type, which must be the type of a
|
||||
/// concrete [InheritedWidget] subclass, and registers this build context with
|
||||
/// that widget such that when that widget changes (or a new widget of that
|
||||
/// type is introduced, or the widget goes away), this build context is
|
||||
/// rebuilt so that it can obtain new values from that widget.
|
||||
///
|
||||
/// This method is deprecated. Please use [dependOnInheritedWidgetOfExactType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use dependOnInheritedWidgetOfExactType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
InheritedWidget? inheritFromWidgetOfExactType(Type targetType, { Object? aspect });
|
||||
|
||||
/// Obtains the nearest widget of the given type `T`, which must be the type of a
|
||||
/// concrete [InheritedWidget] subclass, and registers this build context with
|
||||
/// that widget such that when that widget changes (or a new widget of that
|
||||
@@ -2312,17 +2287,6 @@ abstract class BuildContext {
|
||||
/// widget this context depends on.
|
||||
T? dependOnInheritedWidgetOfExactType<T extends InheritedWidget>({ Object? aspect });
|
||||
|
||||
/// Obtains the element corresponding to the nearest widget of the given type,
|
||||
/// which must be the type of a concrete [InheritedWidget] subclass.
|
||||
///
|
||||
/// This method is deprecated. Please use [getElementForInheritedWidgetOfExactType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use getElementForInheritedWidgetOfExactType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
InheritedElement? ancestorInheritedElementForWidgetOfExactType(Type targetType);
|
||||
|
||||
/// Obtains the element corresponding to the nearest widget of the given type `T`,
|
||||
/// which must be the type of a concrete [InheritedWidget] subclass.
|
||||
///
|
||||
@@ -2341,17 +2305,6 @@ abstract class BuildContext {
|
||||
/// the widget is removed from the tree.
|
||||
InheritedElement? getElementForInheritedWidgetOfExactType<T extends InheritedWidget>();
|
||||
|
||||
/// Returns the nearest ancestor widget of the given type, which must be the
|
||||
/// type of a concrete [Widget] subclass.
|
||||
///
|
||||
/// This method is deprecated. Please use [findAncestorWidgetOfExactType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findAncestorWidgetOfExactType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
Widget? ancestorWidgetOfExactType(Type targetType);
|
||||
|
||||
/// Returns the nearest ancestor widget of the given type `T`, which must be the
|
||||
/// type of a concrete [Widget] subclass.
|
||||
///
|
||||
@@ -2378,17 +2331,6 @@ abstract class BuildContext {
|
||||
/// ancestors of this context.
|
||||
T? findAncestorWidgetOfExactType<T extends Widget>();
|
||||
|
||||
/// Returns the [State] object of the nearest ancestor [StatefulWidget] widget
|
||||
/// that matches the given [TypeMatcher].
|
||||
///
|
||||
/// This method is deprecated. Please use [findAncestorStateOfType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findAncestorStateOfType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
State? ancestorStateOfType(TypeMatcher matcher);
|
||||
|
||||
/// Returns the [State] object of the nearest ancestor [StatefulWidget] widget
|
||||
/// that is an instance of the given type `T`.
|
||||
///
|
||||
@@ -2422,17 +2364,6 @@ abstract class BuildContext {
|
||||
/// {@end-tool}
|
||||
T? findAncestorStateOfType<T extends State>();
|
||||
|
||||
/// Returns the [State] object of the furthest ancestor [StatefulWidget] widget
|
||||
/// that matches the given [TypeMatcher].
|
||||
///
|
||||
/// This method is deprecated. Please use [findRootAncestorStateOfType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findRootAncestorStateOfType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
State? rootAncestorStateOfType(TypeMatcher matcher);
|
||||
|
||||
/// Returns the [State] object of the furthest ancestor [StatefulWidget] widget
|
||||
/// that is an instance of the given type `T`.
|
||||
///
|
||||
@@ -2444,17 +2375,6 @@ abstract class BuildContext {
|
||||
/// a subtree.
|
||||
T? findRootAncestorStateOfType<T extends State>();
|
||||
|
||||
/// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget
|
||||
/// that matches the given [TypeMatcher].
|
||||
///
|
||||
/// This method is deprecated. Please use [findAncestorRenderObjectOfType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findAncestorRenderObjectOfType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
RenderObject? ancestorRenderObjectOfType(TypeMatcher matcher);
|
||||
|
||||
/// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget
|
||||
/// that is an instance of the given type `T`.
|
||||
///
|
||||
@@ -3959,12 +3879,15 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Registers this build context with [ancestor] such that when
|
||||
/// [ancestor]'s widget changes this build context is rebuilt.
|
||||
///
|
||||
/// This method is deprecated. Please use [dependOnInheritedElement] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use dependOnInheritedElement instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
@override
|
||||
InheritedWidget inheritFromElement(InheritedElement ancestor, { Object? aspect }) {
|
||||
return dependOnInheritedElement(ancestor, aspect: aspect);
|
||||
}
|
||||
@@ -3978,12 +3901,18 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
return ancestor.widget;
|
||||
}
|
||||
|
||||
/// Obtains the nearest widget of the given type, which must be the type of a
|
||||
/// concrete [InheritedWidget] subclass, and registers this build context with
|
||||
/// that widget such that when that widget changes (or a new widget of that
|
||||
/// type is introduced, or the widget goes away), this build context is
|
||||
/// rebuilt so that it can obtain new values from that widget.
|
||||
///
|
||||
/// This method is deprecated. Please use [dependOnInheritedWidgetOfExactType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use dependOnInheritedWidgetOfExactType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
@override
|
||||
InheritedWidget? inheritFromWidgetOfExactType(Type targetType, { Object? aspect }) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLookup());
|
||||
final InheritedElement? ancestor = _inheritedWidgets == null ? null : _inheritedWidgets![targetType];
|
||||
@@ -4007,12 +3936,15 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Obtains the element corresponding to the nearest widget of the given type,
|
||||
/// which must be the type of a concrete [InheritedWidget] subclass.
|
||||
///
|
||||
/// This method is deprecated. Please use [getElementForInheritedWidgetOfExactType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use getElementForInheritedWidgetOfExactType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
@override
|
||||
InheritedElement? ancestorInheritedElementForWidgetOfExactType(Type targetType) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLookup());
|
||||
final InheritedElement? ancestor = _inheritedWidgets == null ? null : _inheritedWidgets![targetType];
|
||||
@@ -4031,12 +3963,15 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
_inheritedWidgets = _parent?._inheritedWidgets;
|
||||
}
|
||||
|
||||
/// Returns the nearest ancestor widget of the given type, which must be the
|
||||
/// type of a concrete [Widget] subclass.
|
||||
///
|
||||
/// This method is deprecated. Please use [findAncestorWidgetOfExactType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findAncestorWidgetOfExactType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
@override
|
||||
Widget? ancestorWidgetOfExactType(Type targetType) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLookup());
|
||||
Element? ancestor = _parent;
|
||||
@@ -4054,12 +3989,15 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
return ancestor?.widget as T?;
|
||||
}
|
||||
|
||||
/// Returns the [State] object of the nearest ancestor [StatefulWidget] widget
|
||||
/// that matches the given [TypeMatcher].
|
||||
///
|
||||
/// This method is deprecated. Please use [findAncestorStateOfType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findAncestorStateOfType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
@override
|
||||
State? ancestorStateOfType(TypeMatcher matcher) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLookup());
|
||||
Element? ancestor = _parent;
|
||||
@@ -4085,12 +4023,15 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
return statefulAncestor?.state as T?;
|
||||
}
|
||||
|
||||
/// Returns the [State] object of the furthest ancestor [StatefulWidget] widget
|
||||
/// that matches the given [TypeMatcher].
|
||||
///
|
||||
/// This method is deprecated. Please use [findRootAncestorStateOfType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findRootAncestorStateOfType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
@override
|
||||
State? rootAncestorStateOfType(TypeMatcher matcher) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLookup());
|
||||
Element? ancestor = _parent;
|
||||
@@ -4116,12 +4057,15 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
return statefulAncestor?.state as T?;
|
||||
}
|
||||
|
||||
/// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget
|
||||
/// that matches the given [TypeMatcher].
|
||||
///
|
||||
/// This method is deprecated. Please use [findAncestorRenderObjectOfType] instead.
|
||||
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
|
||||
@Deprecated(
|
||||
'Use findAncestorRenderObjectOfType instead. '
|
||||
'This feature was deprecated after v1.12.1.'
|
||||
)
|
||||
@override
|
||||
RenderObject? ancestorRenderObjectOfType(TypeMatcher matcher) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLookup());
|
||||
Element? ancestor = _parent;
|
||||
|
||||
@@ -17,4 +17,14 @@ void main() {
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.inheritFromElement(ancestor);
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const BuildContext buildContext = Element(myWidget);
|
||||
buildContext.inheritFromElement(ancestor);
|
||||
buildContext.inheritFromWidgetOfExactType(targetType);
|
||||
buildContext.ancestorInheritedElementForWidgetOfExactType(targetType);
|
||||
buildContext.ancestorWidgetOfExactType(targetType);
|
||||
buildContext.ancestorStateOfType(TypeMatcher<targetType>());
|
||||
buildContext.rootAncestorStateOfType(TypeMatcher<targetType>());
|
||||
buildContext.ancestorRenderObjectOfType(TypeMatcher<targetType>());
|
||||
}
|
||||
|
||||
@@ -17,4 +17,14 @@ void main() {
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.dependOnInheritedElement(ancestor);
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const BuildContext buildContext = Element(myWidget);
|
||||
buildContext.dependOnInheritedElement(ancestor);
|
||||
buildContext.dependOnInheritedWidgetOfExactType<targetType>();
|
||||
buildContext.getElementForInheritedWidgetOfExactType<targetType>();
|
||||
buildContext.findAncestorWidgetOfExactType<targetType>();
|
||||
buildContext.findAncestorStateOfType<targetType>();
|
||||
buildContext.findRootAncestorStateOfType<targetType>();
|
||||
buildContext.findAncestorRenderObjectOfType<targetType>();
|
||||
}
|
||||
|
||||
@@ -16,4 +16,14 @@ void main() {
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.inheritFromElement(ancestor);
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const BuildContext buildContext = Element(myWidget);
|
||||
buildContext.inheritFromElement(ancestor);
|
||||
buildContext.inheritFromWidgetOfExactType(targetType);
|
||||
buildContext.ancestorInheritedElementForWidgetOfExactType(targetType);
|
||||
buildContext.ancestorWidgetOfExactType(targetType);
|
||||
buildContext.ancestorStateOfType(TypeMatcher<targetType>());
|
||||
buildContext.rootAncestorStateOfType(TypeMatcher<targetType>());
|
||||
buildContext.ancestorRenderObjectOfType(TypeMatcher<targetType>());
|
||||
}
|
||||
|
||||
@@ -14,6 +14,16 @@ void main() {
|
||||
binding.allowFirstFrame();
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.dependOnInheritedElement(ancestor);
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.dependOnInheritedElement(ancestor);
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const BuildContext buildContext = Element(myWidget);
|
||||
buildContext.dependOnInheritedElement(ancestor);
|
||||
buildContext.dependOnInheritedWidgetOfExactType<targetType>();
|
||||
buildContext.getElementForInheritedWidgetOfExactType<targetType>();
|
||||
buildContext.findAncestorWidgetOfExactType<targetType>();
|
||||
buildContext.findAncestorStateOfType<targetType>();
|
||||
buildContext.findRootAncestorStateOfType<targetType>();
|
||||
buildContext.findAncestorRenderObjectOfType<targetType>();
|
||||
}
|
||||
|
||||
@@ -13,4 +13,14 @@ void main() {
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.inheritFromElement(ancestor);
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const BuildContext buildContext = Element(myWidget);
|
||||
buildContext.inheritFromElement(ancestor);
|
||||
buildContext.inheritFromWidgetOfExactType(targetType);
|
||||
buildContext.ancestorInheritedElementForWidgetOfExactType(targetType);
|
||||
buildContext.ancestorWidgetOfExactType(targetType);
|
||||
buildContext.ancestorStateOfType(TypeMatcher<targetType>());
|
||||
buildContext.rootAncestorStateOfType(TypeMatcher<targetType>());
|
||||
buildContext.ancestorRenderObjectOfType(TypeMatcher<targetType>());
|
||||
}
|
||||
|
||||
@@ -13,4 +13,14 @@ void main() {
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.dependOnInheritedElement(ancestor);
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const BuildContext buildContext = Element(myWidget);
|
||||
buildContext.dependOnInheritedElement(ancestor);
|
||||
buildContext.dependOnInheritedWidgetOfExactType<targetType>();
|
||||
buildContext.getElementForInheritedWidgetOfExactType<targetType>();
|
||||
buildContext.findAncestorWidgetOfExactType<targetType>();
|
||||
buildContext.findAncestorStateOfType<targetType>();
|
||||
buildContext.findRootAncestorStateOfType<targetType>();
|
||||
buildContext.findAncestorRenderObjectOfType<targetType>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user