flutterx_utils 1.0.9-dev copy "flutterx_utils: ^1.0.9-dev" to clipboard
flutterx_utils: ^1.0.9-dev copied to clipboard

outdated

A collection of Flutter utilities for any purpose. Check out the source code for documentation

example/lib/main.dart

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutterx Utils Demo',
      theme: ThemeData(primarySwatch: Colors.orange),
      home: const LoggableExample());
}

class LoggableExample extends StatefulWidget {
  const LoggableExample({Key? key}) : super(key: key);

  @override
  State<LoggableExample> createState() => _LoggableExampleState();
}

class _LoggableExampleState extends State<LoggableExample> with Loggable {
  final List<String> _logs = [];

  @override
  Widget build(BuildContext context) => Scaffold(
      appBar: AppBar(title: const Text('Loggable example')),
      body: Center(child: Text(_logs.join('\n'))),
      floatingActionButton:
          FloatingActionButton(onPressed: () => log('FAB pressed'), tooltip: 'Log', child: const Icon(Icons.add)));

  @override
  void logImpl(String message, [Object? error, StackTrace? stack]) => setState(() => _logs.add('$tag$indent$message'));
}
2
likes
0
points
321
downloads

Publisher

unverified uploader

Weekly Downloads

A collection of Flutter utilities for any purpose. Check out the source code for documentation

Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutterx_utils