devtodollars / mvp-boilerplate

A mobile and/or web boilerplate that covers all your MVP needs
https://devtodollars.com
MIT License
704 stars 75 forks source link

add error monitoring (sentry) #18

Open matthewwong525 opened 6 months ago

RyanParkGH commented 4 months ago

Hi Matt, Love the idea, happy to contribute as well.

For Sentry integration, the basic integration is simply to add the dependency to pubspec.yaml:

dependencies:
...
  sentry_flutter: ^8.2.0

And include the following code in main.dart:

import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
...
  await SentryFlutter.init(
    (options) {
      options.dsn = 'https://example@sentry.io/add-your-dsn-here';
    },
    // Init your App.
    appRunner: () => runApp(MyApp()),
  );
}

That's all it takes to get basic integration going.

Given the above takes about 2 minutes or less, I'm confused why this isn't part of the existing template. I may be being obtuse, so feel free to correct me! :)

matthewwong525 commented 4 months ago

@Autom8r-82 I haven't added it yet because I'd need update flutter, next.js and add documentation. I was also thinking about the best way to incorporate this to make it easy to remove in case someone didn't want to use Sentry.

But, appreciate the code! I'll be sure to get to it soon especially since now it seems like there is some sort of demand for it.