katana_logger 2.0.23 copy "katana_logger: ^2.0.23" to clipboard
katana_logger: ^2.0.23 copied to clipboard

unlisted

Base package for logging app performance and access status. Additional packages can be installed to use Firebase Analytics, etc.

example/lib/main.dart

// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:katana_logger/katana_logger.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return LoggerAdapterScope(
      adapters: const [RuntimeLoggerAdapter()],
      child: MaterialApp(
        home: const LoggerPage(),
        title: "Flutter Demo",
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
      ),
    );
  }
}

class LoggerPage extends StatefulWidget {
  const LoggerPage({super.key});

  @override
  State<StatefulWidget> createState() => LoggerPageState();
}

class LoggerPageState extends State<LoggerPage> {
  final logger = Logger();
  List<LogValue> _values = [];

  @override
  void initState() {
    super.initState();
    logger.addListener(_handledOnUpdate);
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    _handledOnUpdate();
  }

  Future<void> _handledOnUpdate() async {
    _values = await logger.logList();
    setState(() {});
  }

  @override
  void dispose() {
    super.dispose();
    logger.removeListener(_handledOnUpdate);
    logger.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("App Demo")),
      body: ListView(
        children: [
          ..._values.map(
            (e) => ListTile(
              title: Text(e.name),
              subtitle: Text(e.dateTime.toIso8601String()),
            ),
          )
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          logger.sendRawData("test", parameters: {"count": 5});
        },
        child: const Icon(Icons.add),
      ),
    );
  }
}
0
likes
0
pub points
7%
popularity

Publisher

verified publishermathru.net

Base package for logging app performance and access status. Additional packages can be installed to use Firebase Analytics, etc.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, katana, path_provider, shared_preferences

More

Packages that depend on katana_logger