Skip to content

Instantly share code, notes, and snippets.

View Zifthis's full-sized avatar
😵‍💫

Matija Kovačević Zifthis

😵‍💫
View GitHub Profile
@Zifthis
Zifthis / Oauth 2.0 & WebView Flutter
Last active July 27, 2023 06:48
Flutter app utilizing OAuth 2.0 and WebView for user authentication. Securely obtain access tokens for APIs in just a few steps.
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:oauth2/oauth2.dart' as oauth2;
import 'package:flutter_appauth/flutter_appauth.dart';
import 'dart:async';
class AuthTest {
Future<AuthorizationTokenResponse> createClient(BuildContext context) async {
const String clientId = 'clientName';
const String redirectUrl =
@Zifthis
Zifthis / automatic_breadcrumbs
Last active February 10, 2022 08:27
Automatic Breadcrumbs
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
MaterialApp(
navigatorObservers: [
SentryNavigatorObserver(),
],
);
@Zifthis
Zifthis / sentry_breadcrumb
Created February 9, 2022 09:48
sentry breadcrumb
body: ElevatedButton(
child: const Text('Breadcrumb'),
onPressed: () {
print('A print breadcrumb');
Sentry.captureMessage('A message with a print() Breadcrumb');
},
),
@Zifthis
Zifthis / throw_error.txt
Created February 3, 2022 09:02
throw_error
body: ElevatedButton(
child: const Text('async throws'),
onPressed: () => asyncThrows(),
),
@Zifthis
Zifthis / sentry_dependency.txt
Last active February 3, 2022 08:51
sentry_dependency
dependencies:
sentry_flutter: ^6.2.2
@Zifthis
Zifthis / sentry_setup.txt
Last active February 3, 2022 08:51
sentry_setup
import 'package:sentry_flutter/sentry_flutter.dart';
const String _exampleDsn =
'https://yourSentryDsnHere@sentry.com';
Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = _exampleDsn;
options.tracesSampleRate = 1.0;