From 590688743be9d76bc161be585787834fded6ca36 Mon Sep 17 00:00:00 2001 From: Greg Littlefield Date: Mon, 1 May 2017 15:13:36 -0700 Subject: [PATCH 1/2] Workaround for Dart 1.23 strong mode issue with MapViewMixin --- .../component_declaration/component_base.dart | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/src/component_declaration/component_base.dart b/lib/src/component_declaration/component_base.dart index d147c98b0..6f2f81995 100644 --- a/lib/src/component_declaration/component_base.dart +++ b/lib/src/component_declaration/component_base.dart @@ -412,12 +412,22 @@ abstract class UiProps Function get componentFactory; } +/// A class that declares the `_map` getter shared by [PropsMapViewMixin]/[StateMapViewMixin] and [MapViewMixin]. +/// +/// Necessary in order to work around Dart 1.23 strong mode change that disallows conflicting private members +/// in mixins: . +abstract class _OverReactMapViewBase { + Map get _map; +} + /// Works in conjunction with [MapViewMixin] to provide [dart.collection.MapView]-like /// functionality to [UiProps] subclasses. -abstract class PropsMapViewMixin { +abstract class PropsMapViewMixin implements _OverReactMapViewBase { /// The props maintained by this builder and used passed into the component when built. /// In this case, it's the current MapView object. Map get props; + + @override Map get _map => this.props; @override @@ -426,8 +436,10 @@ abstract class PropsMapViewMixin { /// Works in conjunction with [MapViewMixin] to provide [dart.collection.MapView]-like /// functionality to [UiState] subclasses. -abstract class StateMapViewMixin { +abstract class StateMapViewMixin implements _OverReactMapViewBase { Map get state; + + @override Map get _map => this.state; @override @@ -441,9 +453,7 @@ abstract class StateMapViewMixin { /// /// For use by concrete [UiProps] and [UiState] implementations (either generated or manual), /// and thus must remain public. -abstract class MapViewMixin { - Map get _map; - +abstract class MapViewMixin implements _OverReactMapViewBase { V operator[](Object key) => _map[key]; void operator[]=(K key, V value) { _map[key] = value; } void addAll(Map other) { _map.addAll(other); } From 3bfd9386c99ed4f655953ab48b448d3539f59573 Mon Sep 17 00:00:00 2001 From: Greg Littlefield Date: Mon, 1 May 2017 15:31:45 -0700 Subject: [PATCH 2/2] Update generic parameters to work with strong mode <1.23 --- lib/src/component_declaration/component_base.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/component_declaration/component_base.dart b/lib/src/component_declaration/component_base.dart index 6f2f81995..295f09afe 100644 --- a/lib/src/component_declaration/component_base.dart +++ b/lib/src/component_declaration/component_base.dart @@ -416,8 +416,8 @@ abstract class UiProps /// /// Necessary in order to work around Dart 1.23 strong mode change that disallows conflicting private members /// in mixins: . -abstract class _OverReactMapViewBase { - Map get _map; +abstract class _OverReactMapViewBase { + Map get _map; } /// Works in conjunction with [MapViewMixin] to provide [dart.collection.MapView]-like @@ -453,7 +453,7 @@ abstract class StateMapViewMixin implements _OverReactMapViewBase { /// /// For use by concrete [UiProps] and [UiState] implementations (either generated or manual), /// and thus must remain public. -abstract class MapViewMixin implements _OverReactMapViewBase { +abstract class MapViewMixin implements _OverReactMapViewBase { V operator[](Object key) => _map[key]; void operator[]=(K key, V value) { _map[key] = value; } void addAll(Map other) { _map.addAll(other); }