one_line_logger 1.0.4 copy "one_line_logger: ^1.0.4" to clipboard
one_line_logger: ^1.0.4 copied to clipboard

A simple flutter logger plugin with a cloud hosted UI

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:one_line_logger/one_line_logger.dart';

final logger = OneLineLogger();

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'OneLineLogger Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('OneLineLogger Example'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('Tap a button to send a log to the dashboard'),
            const SizedBox(height: 24),
            ElevatedButton.icon(
              onPressed: () {
                // Example call to logger.debug
                logger.debug('User clicked the debug button in example app');
              },
              icon: const Icon(Icons.bug_report),
              label: const Text('Send Debug Log'),
            ),
            const SizedBox(height: 16),
            ElevatedButton.icon(
              onPressed: () {
                // Example call to logger.error
                logger.error('User triggered a simulated error in example app');
              },
              icon: const Icon(Icons.error),
              label: const Text('Send Error Log'),
              style: ElevatedButton.styleFrom(
                foregroundColor: Colors.white,
                backgroundColor: Colors.red,
              ),
            ),
          ],
        ),
      ),
    );
  }
}