Skip to content

Commit b9c2517

Browse files
authored
Merge pull request #65 from greglittlefield-wf/dart_1.23_strong_fix
UIP-2258 Workaround for Dart 1.23 strong mode issue with MapViewMixin
2 parents 5673293 + 3bfd938 commit b9c2517

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lib/src/component_declaration/component_base.dart

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,22 @@ abstract class UiProps
412412
Function get componentFactory;
413413
}
414414

415+
/// A class that declares the `_map` getter shared by [PropsMapViewMixin]/[StateMapViewMixin] and [MapViewMixin].
416+
///
417+
/// Necessary in order to work around Dart 1.23 strong mode change that disallows conflicting private members
418+
/// in mixins: <https://github.com/dart-lang/sdk/issues/28809>.
419+
abstract class _OverReactMapViewBase<K, V> {
420+
Map<K, V> get _map;
421+
}
422+
415423
/// Works in conjunction with [MapViewMixin] to provide [dart.collection.MapView]-like
416424
/// functionality to [UiProps] subclasses.
417-
abstract class PropsMapViewMixin {
425+
abstract class PropsMapViewMixin implements _OverReactMapViewBase {
418426
/// The props maintained by this builder and used passed into the component when built.
419427
/// In this case, it's the current MapView object.
420428
Map get props;
429+
430+
@override
421431
Map get _map => this.props;
422432

423433
@override
@@ -426,8 +436,10 @@ abstract class PropsMapViewMixin {
426436

427437
/// Works in conjunction with [MapViewMixin] to provide [dart.collection.MapView]-like
428438
/// functionality to [UiState] subclasses.
429-
abstract class StateMapViewMixin {
439+
abstract class StateMapViewMixin implements _OverReactMapViewBase {
430440
Map get state;
441+
442+
@override
431443
Map get _map => this.state;
432444

433445
@override
@@ -441,9 +453,7 @@ abstract class StateMapViewMixin {
441453
///
442454
/// For use by concrete [UiProps] and [UiState] implementations (either generated or manual),
443455
/// and thus must remain public.
444-
abstract class MapViewMixin<K, V> {
445-
Map<K, V> get _map;
446-
456+
abstract class MapViewMixin<K, V> implements _OverReactMapViewBase<K, V> {
447457
V operator[](Object key) => _map[key];
448458
void operator[]=(K key, V value) { _map[key] = value; }
449459
void addAll(Map<K, V> other) { _map.addAll(other); }

0 commit comments

Comments
 (0)