Coder Social home page Coder Social logo

nylo-core / error-stack Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 830 KB

Easy error handling for Flutter applications! Modern UI for errors, updated logging to keep you productive.

Home Page: https://nylo.dev

License: MIT License

Dart 86.94% Kotlin 0.46% Ruby 5.28% Swift 2.57% Objective-C 0.14% HTML 4.60%
dart error-handling errors exception-handling exceptions flutter

error-stack's Introduction

Error Stack for Flutter

pub package License: MIT

Simple to use

Nylo

// Add Error Stack to your Nylo app provider
...
import 'package:error_stack/error_stack.dart';

class AppProvider {

  @override
  boot(Nylo nylo) async {
    ...
    nylo.useErrorStack(); // enables Error Stack
  }
}

Flutter App

// Add Error Stack to your main.dart file
...
import 'package:error_stack/error_stack.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await ErrorStack.init(); // Initialize Error Stack
  runApp(MyApp());
}

Once you have added Error Stack to your application, it will override the default error handling in your application.

Features

  • Instant Google search to resolve error
  • Copy error message to clipboard
  • Modern UI for debug and release mode
  • Light and Dark mode support
  • Customizable Production Error Page

Getting started

Installation

Add the following to your pubspec.yaml file:

dependencies:
  error_stack: ^1.8.1

or with Dart:

dart pub add error_stack

How to use

The package is very simple to use.

Log Levels

  • ErrorStackLogLevel.verbose (default)
  • ErrorStackLogLevel.minimal (shows less information)

You can set the log level when initializing Error Stack.

Flutter App

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await ErrorStack.init(logLevel: ErrorStackLogLevel.minimal); // Initialize Error Stack
  runApp(MyApp());
}

Nylo

import 'package:error_stack/error_stack.dart';

class AppProvider {
    
  @override
  boot(Nylo nylo) async {
     ...
     nylo.useErrorStack(logLevel: ErrorStackLogLevel.minimal);
  }
}

Full Parameters

ErrorStack.init(
	level: ErrorStackLogLevel.verbose,  // The ErrorStackLogLevel.verbose | ErrorStackLogLevel.minimal
	initialRoute: "/", // Navigate to this route when tapping "Restart app"
	errorWidget: (errorDetails) { // The error widget you want to show in release mode
    	return Scaffold(
      	    appBar: AppBar(
        	    title: Text("Error"),
      	    ),
      	    body: Center(
        	    child: Text("An error occurred"),
      	    ),
    	);
	}
);

Try the example app to see how it works.

Changelog

Please see CHANGELOG for more information what has changed recently.

Social

Licence

The MIT License (MIT). Please view the License File for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.