title: How to test a callback function in a Flutter widget
body: <p>I have a custom Flutter widget, RadioSelect, which accepts an array of options and a callback function when one of those options is pressed. The callback is called with the selected option passed as it's only parameter. I'm trying to write a test which verifies that the callback was called and checks that the returned parameter is correct but I'm not sure how to structure it. What's a sensible way to check that a standalone callback function was called?</p>
  
  <pre><code>  await tester.pumpWidget(
      StatefulBuilder(
        builder: (BuildContext context, StateSetter setState) {
          return MaterialApp(
            home:  RadioSelect(
                                  ["option1","option2", "option3"], 
                                  // callback function passed here
                                  ),
              );
        },
      ),
    );
  
  expect(find.text('option1'), findsOneWidget);
  
  await tester.press(find.text('option2'));
  
  await tester.pump();
  
  // test for callback here
  </code></pre>