owlscope 0.1.5 copy "owlscope: ^0.1.5" to clipboard
owlscope: ^0.1.5 copied to clipboard

Real-time debug & monitoring SDK for Flutter — forwards print, errors, HTTP traffic, navigation and performance events to the OwlScope desktop app over WebSocket.

example/main.dart

// Minimal OwlScope example. See the package README for full integration
// instructions.
//
// Run the OwlScope desktop app first, then `flutter run` this example.

import 'package:flutter/material.dart';
import 'package:owlscope/auto.dart';
import 'package:owlscope/owlscope.dart';

void main() {
  owlscopeAuto(() => runApp(const OwlScopeExampleApp()), name: 'owlscope-example');
}

class OwlScopeExampleApp extends StatelessWidget {
  const OwlScopeExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorObservers: [owlscopeNavigatorObserver],
      home: Scaffold(
        appBar: AppBar(title: const Text('OwlScope example')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () => debugPrint('Hello from OwlScope at ${DateTime.now()}'),
                child: const Text('Send a log'),
              ),
              const SizedBox(height: 12),
              ElevatedButton(
                onPressed: () => OwlScope.instance.event('user-action', {'click': 'demo'}),
                child: const Text('Send a custom event'),
              ),
              const SizedBox(height: 12),
              ElevatedButton(
                onPressed: () {
                  try {
                    throw StateError('Demo error from OwlScope example');
                  } catch (e, st) {
                    OwlScope.instance.error('Caught', error: e, stackTrace: st);
                  }
                },
                child: const Text('Send an error'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
145
points
287
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Real-time debug & monitoring SDK for Flutter — forwards print, errors, HTTP traffic, navigation and performance events to the OwlScope desktop app over WebSocket.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, web_socket_channel

More

Packages that depend on owlscope