Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get*Prop methods to WidgetSelector #71

Merged
merged 2 commits into from
Nov 13, 2024
Merged

Add get*Prop methods to WidgetSelector #71

merged 2 commits into from
Nov 13, 2024

Conversation

passsy
Copy link
Owner

@passsy passsy commented Nov 12, 2024

WidgetSelector now directly allows reading properties:

await tester.pumpWidget(const _MyContainer(color: Colors.white54));
final color = spot<_MyContainer>().getWidgetProp(widgetProp('color', (widget) => widget.color));
expect(color, Colors.white54);

There is also the new getStateProp for WidgetSelector and WidgetMatcher

final innerValue = spot<_MyContainer>().getStateProp(
    stateProp<String, _MyContainerState>('innerValue', (s) => s.innerValue),
);
expect(innerValue, 'stateValue');

@passsy passsy merged commit dbeefc4 into main Nov 13, 2024
5 checks passed
@passsy passsy deleted the prop_getter branch November 13, 2024 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant