Skip to content

Commit c8b41b7

Browse files
Parameterize Expando
1 parent dd869c5 commit c8b41b7

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

lib/src/component_declaration/component_base.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,15 @@ abstract class UiComponent<TProps extends UiProps> extends react.Component {
157157
// BEGIN Typed props helpers
158158
//
159159

160-
/// Keep this Expando unparameterized to work around this bug: <https://github.com/dart-lang/sdk/issues/26743>
161-
Expando _typedPropsCache = new Expando();
160+
var _typedPropsCache = new Expando<TProps>();
162161

163162
/// A typed props object corresponding to the current untyped props Map ([unwrappedProps]).
164163
///
165164
/// Created using [typedPropsFactory] and cached for each Map instance.
166165
@override
167166
TProps get props {
168167
var unwrappedProps = this.unwrappedProps;
169-
/// Have to cast as [TProps] until we can parameterize [_typedPropsCache].
170-
///
171-
/// See: <https://github.com/dart-lang/sdk/issues/26743>
172-
var typedProps = _typedPropsCache[unwrappedProps] as TProps; // ignore: avoid_as
168+
var typedProps = _typedPropsCache[unwrappedProps];
173169
if (typedProps == null) {
174170
typedProps = typedPropsFactory(unwrappedProps);
175171
_typedPropsCache[unwrappedProps] = typedProps;
@@ -211,19 +207,15 @@ abstract class UiStatefulComponent<TProps extends UiProps, TState extends UiStat
211207
// BEGIN Typed state helpers
212208
//
213209

214-
/// Keep this Expando unparameterized to work around this bug: <https://github.com/dart-lang/sdk/issues/26743>
215-
Expando _typedStateCache = new Expando();
210+
var _typedStateCache = new Expando<TState>();
216211

217212
/// A typed state object corresponding to the current untyped state Map ([unwrappedState]).
218213
///
219214
/// Created using [typedStateFactory] and cached for each Map instance.
220215
@override
221216
TState get state {
222217
var unwrappedState = this.unwrappedState;
223-
/// Have to cast as [TState] until we can parameterize [_typedStateCache].
224-
///
225-
/// See: <https://github.com/dart-lang/sdk/issues/26743>
226-
var typedState = _typedStateCache[unwrappedState] as TState; // ignore: avoid_as
218+
var typedState = _typedStateCache[unwrappedState];
227219
if (typedState == null) {
228220
typedState = typedStateFactory(unwrappedState);
229221
_typedStateCache[unwrappedState] = typedState;

0 commit comments

Comments
 (0)