octopus 0.0.8 copy "octopus: ^0.0.8" to clipboard
octopus: ^0.0.8 copied to clipboard

A cross-platform declarative router for Flutter with a focus on state and nested navigation. Made with ❤️ by PlugFox.

example/lib/main.dart

import 'dart:async';

import 'package:example/src/common/util/error_util.dart';
import 'package:example/src/common/widget/app.dart';
import 'package:example/src/common/widget/app_error.dart';
import 'package:example/src/feature/initialization/data/initialization.dart';
import 'package:example/src/feature/initialization/widget/inherited_dependencies.dart';
import 'package:flutter/widgets.dart';
import 'package:l/l.dart';

void main() => l.capture<void>(
      () => runZonedGuarded<void>(
        () async {
          // Splash screen
          final initializationProgress =
              ValueNotifier<({int progress, String message})>(
                  (progress: 0, message: ''));
          /* runApp(SplashScreen(progress: initializationProgress)); */
          $initializeApp(
            onProgress: (progress, message) => initializationProgress.value =
                (progress: progress, message: message),
            onSuccess: (dependencies) => runApp(
              InheritedDependencies(
                dependencies: dependencies,
                child: const App(),
              ),
            ),
            onError: (error, stackTrace) {
              runApp(AppError(error: error));
              ErrorUtil.logError(error, stackTrace).ignore();
            },
          ).ignore();
        },
        l.e,
      ),
      const LogOptions(
        handlePrint: true,
        messageFormatting: _messageFormatting,
        outputInRelease: false,
        printColors: true,
      ),
    );

/// Formats the log message.
Object _messageFormatting(Object message, LogLevel logLevel, DateTime now) =>
    '${_timeFormat(now)} | $message';

/// Formats the time.
String _timeFormat(DateTime time) =>
    '${time.hour}:${time.minute.toString().padLeft(2, '0')}';
52
likes
140
pub points
77%
popularity

Publisher

verified publisherplugfox.dev

A cross-platform declarative router for Flutter with a focus on state and nested navigation. Made with ❤️ by PlugFox.

Repository (GitHub)
View/report issues

Topics

#router #navigation #navigator #state #octopus

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com
www.patreon.com
boosty.to

License

MIT (LICENSE)

Dependencies

collection, flutter, meta

More

Packages that depend on octopus