Skip to content

Commit

Permalink
fix: Not starting sentry fix (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
M123-dev authored Feb 19, 2022
1 parent 23e09bc commit 17229d0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/smooth_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Future<void> main() async {

if (kReleaseMode) {
await AnalyticsHelper.initSentry(
appRunner: () => const SmoothApp(),
appRunner: () => runApp(const SmoothApp()),
);
} else {
runApp(DevicePreview(
Expand Down Expand Up @@ -177,15 +177,21 @@ class SmoothAppGetLanguage extends StatefulWidget {
State<SmoothAppGetLanguage> createState() => _SmoothAppGetLanguageState();
}

// Currently converted into a StatefulWidget to call trackStart in initState
// since this widget got rebuild multiple time which it shouldn't
// TODO(open): Fix unnecessary rebuilds
class _SmoothAppGetLanguageState extends State<SmoothAppGetLanguage> {
@override
void initState() {
final LocalDatabase _localDatabase = context.read<LocalDatabase>();
AnalyticsHelper.trackStart(_localDatabase, context);
super.initState();

// Currently converted into a StatefulWidget to call trackStart in initState
// since this widget got rebuild multiple time which it shouldn't
// TODO(open): Fix unnecessary rebuilds
WidgetsBinding.instance?.addPostFrameCallback((_) {
final LocalDatabase _localDatabase = Provider.of<LocalDatabase>(
context,
listen: false,
);
AnalyticsHelper.trackStart(_localDatabase, context);
});
}

@override
Expand Down

0 comments on commit 17229d0

Please sign in to comment.