initializeAndRun method
Initializes the SDK and runs body inside the log-capture zone so that
all print() calls are automatically captured.
This is the recommended way to start Critic with full log capture:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Critic().initializeAndRun('your-api-token', () => runApp(MyApp()));
}
Implementation
Future<void> initializeAndRun(
String apiToken,
void Function() body, {
String? baseUrl,
}) async {
final zone = await initialize(apiToken, baseUrl: baseUrl);
zone.run(body);
}