One way is to use testWidgets in combination with a Builder widget:
testWidgets('me testing', (WidgetTester tester) async {
await tester.pumpWidget(
Builder(
builder: (BuildContext context) {
var actual = sut.myMethodName(context, ...);
expect(actual, something);
// The builder function must return a widget.
return Placeholder();
},
),
);
});