Skip to content
Merged
5 changes: 1 addition & 4 deletions lib/src/component/error_boundary_mixins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ abstract class _$ErrorBoundaryStateMixin implements UiState {
/// }
mixin ErrorBoundaryMixin<T extends ErrorBoundaryPropsMixin, S extends ErrorBoundaryStateMixin>
on UiStatefulComponent2<T, S> {
@mustCallSuper
@override
void init() {
initializeState(newState()..hasError = false);
}
Map get initialState => newState()..hasError = false;

@mustCallSuper
@override
Expand Down
5 changes: 3 additions & 2 deletions lib/src/component_declaration/builder_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ class GeneratedClass {
}
}

/// Do not implement component_base.UiComponent via `implements` or `on`. This is
/// to work around https://github.com/dart-lang/sdk/issues/38098.
mixin _GeneratedUiComponentStubs<TProps extends UiProps>
on component_base.UiComponent<TProps>, GeneratedClass {
implements GeneratedClass {
/// The default consumed props, taken from the keys generated in the associated @[annotations.Props] class.
@toBeGenerated
Iterable<component_base.ConsumedProps> get $defaultConsumedProps => throw new UngeneratedError(member: #$defaultConsumedProps);
Expand All @@ -52,7 +54,6 @@ mixin _GeneratedUiComponentStubs<TProps extends UiProps>
///
/// For generated components, this defaults to the keys generated in the associated @[annotations.Props] class
/// if this getter is not overridden.
@override
Iterable<component_base.ConsumedProps> get consumedProps => $defaultConsumedProps;

/// Returns a typed props object backed by the specified [propsMap].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class _$ContextProviderWrapperState extends UiState {
class ContextProviderWrapperComponent extends UiStatefulComponent2<ContextProviderWrapperProps, ContextProviderWrapperState> {

@override
init(){
initializeState(newState()..latestValue = 1);
}
Map get initialState => newState()..latestValue = 1;

@override
render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class _$ComponentTestProps extends UiProps {
@Component2()
class ComponentTestComponent extends UiComponent2<ComponentTestProps> {
@override
Map getDefaultProps() => newProps()
Map get defaultProps => newProps()
..id = 'testId'
..shouldSetPropsDirectly = false
..shouldUseJsFactory = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class _$FooProps extends UiProps {
@Component2()
class FooComponent extends UiComponent2<FooProps> {
@override
Map getDefaultProps() => newProps().._privateProp = 'some private value';
Map get defaultProps => newProps().._privateProp = 'some private value';

@override
render() => (Dom.div())(props._privateProp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,20 @@ class _$StatefulComponentTestState extends UiState {
@Component2()
class StatefulComponentTestComponent extends UiStatefulComponent2<StatefulComponentTestProps, StatefulComponentTestState> {
@override
Map getDefaultProps() => newProps()..setStateDirectly = false;
Map get defaultProps => newProps()..setStateDirectly = false;

@override
void init() {
Map get initialState {
if (this.props.setStateDirectly) {
this.state = newState()
..stringState = '1';
return newState()..stringState = '1';
} else {
this.initializeState(newState()
..stringState = '1'
..dynamicState = '2'
..untypedState = '3'
..customKeyState = '4'
..customNamespaceState = '5'
..customKeyAndNamespaceState = '6');
return newState()
..stringState = '1'
..dynamicState = '2'
..untypedState = '3'
..customKeyState = '4'
..customNamespaceState = '5'
..customKeyAndNamespaceState = '6';
}
}

Expand Down