feat: add monitoring

This commit is contained in:
Golek 2022-12-01 11:32:09 +07:00
parent 243a620548
commit cf1af613a5
9 changed files with 575 additions and 63 deletions

View File

@ -47,7 +47,7 @@ android {
applicationId "com.golektruk.golek_flutter_new"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

View File

@ -0,0 +1,134 @@
{
"project_info": {
"project_number": "97591185685",
"project_id": "dev-talentkita-golek",
"storage_bucket": "dev-talentkita-golek.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:97591185685:android:f802b2a7a67c67388d991c",
"android_client_info": {
"package_name": "com.golektruk.dotcom"
}
},
"oauth_client": [
{
"client_id": "97591185685-t8vnlgqq3dnepi36b3bh51bltcpqonbp.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.golektruk.dotcom",
"certificate_hash": "0de3c1bdd00344c145e1f37e56a94c614b2490b4"
}
},
{
"client_id": "97591185685-p4qccp7b4sqs6p5fmmoip1g8q2o9ek3m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDenqsPlc8hyhy_CRTBQolOWvEYp0QkiwU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "97591185685-p4qccp7b4sqs6p5fmmoip1g8q2o9ek3m.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "97591185685-e4r8sejq76g4osq0regtb7ngr9usndsk.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.golekFlutter"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:97591185685:android:2df08f4bdc5c06e68d991c",
"android_client_info": {
"package_name": "com.golektruk.golek_flutter_new"
}
},
"oauth_client": [
{
"client_id": "97591185685-p4qccp7b4sqs6p5fmmoip1g8q2o9ek3m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDenqsPlc8hyhy_CRTBQolOWvEYp0QkiwU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "97591185685-p4qccp7b4sqs6p5fmmoip1g8q2o9ek3m.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "97591185685-e4r8sejq76g4osq0regtb7ngr9usndsk.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.golekFlutter"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:97591185685:android:aef45514f1f2aa9f8d991c",
"android_client_info": {
"package_name": "com.talenta.golektruk"
}
},
"oauth_client": [
{
"client_id": "97591185685-jjnuop65uak1u0vag6tesjgt1sfu2i60.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.talenta.golektruk",
"certificate_hash": "0de3c1bdd00344c145e1f37e56a94c614b2490b4"
}
},
{
"client_id": "97591185685-p4qccp7b4sqs6p5fmmoip1g8q2o9ek3m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDenqsPlc8hyhy_CRTBQolOWvEYp0QkiwU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "97591185685-p4qccp7b4sqs6p5fmmoip1g8q2o9ek3m.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "97591185685-e4r8sejq76g4osq0regtb7ngr9usndsk.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.golekFlutter"
}
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>97591185685-papkbvrvnsurvorfna3d2nknasidckjs.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.97591185685-papkbvrvnsurvorfna3d2nknasidckjs</string>
<key>ANDROID_CLIENT_ID</key>
<string>97591185685-jjnuop65uak1u0vag6tesjgt1sfu2i60.apps.googleusercontent.com</string>
<key>API_KEY</key>
<string>AIzaSyBV3djMnp6iGQJog9RK0hwnKwBdmP4ZKkA</string>
<key>GCM_SENDER_ID</key>
<string>97591185685</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.golektruk.golekFlutterNew</string>
<key>PROJECT_ID</key>
<string>dev-talentkita-golek</string>
<key>STORAGE_BUCKET</key>
<string>dev-talentkita-golek.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:97591185685:ios:c408a8133e24a8258d991c</string>
</dict>
</plist>

View File

@ -0,0 +1,7 @@
{
"file_generated_by": "FlutterFire CLI",
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
"GOOGLE_APP_ID": "1:97591185685:ios:c408a8133e24a8258d991c",
"FIREBASE_PROJECT_ID": "dev-talentkita-golek",
"GCM_SENDER_ID": "97591185685"
}

70
lib/firebase_options.dart Normal file
View File

@ -0,0 +1,70 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyDenqsPlc8hyhy_CRTBQolOWvEYp0QkiwU',
appId: '1:97591185685:android:2df08f4bdc5c06e68d991c',
messagingSenderId: '97591185685',
projectId: 'dev-talentkita-golek',
storageBucket: 'dev-talentkita-golek.appspot.com',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyBV3djMnp6iGQJog9RK0hwnKwBdmP4ZKkA',
appId: '1:97591185685:ios:c408a8133e24a8258d991c',
messagingSenderId: '97591185685',
projectId: 'dev-talentkita-golek',
storageBucket: 'dev-talentkita-golek.appspot.com',
androidClientId: '97591185685-jjnuop65uak1u0vag6tesjgt1sfu2i60.apps.googleusercontent.com',
iosClientId: '97591185685-papkbvrvnsurvorfna3d2nknasidckjs.apps.googleusercontent.com',
iosBundleId: 'com.golektruk.golekFlutterNew',
);
}

18
lib/golektruk.dart Normal file
View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
class GolekTruk extends StatelessWidget {
const GolekTruk({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const Scaffold(
body: Text('HomePage GolekTruk'),
),
);
}
}

View File

@ -1,66 +1,40 @@
import 'dart:async';
import 'dart:isolate';
import 'package:flutter/material.dart';
import 'package:golek_flutter_new/golektruk.dart';
import 'package:monitoring/monitoring.dart';
import 'firebase_options.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
// Has to be late so it doesn't instantiate before the
// `initializeMonitoringPackage()` call.
late final errorReportingService = ErrorReportingService();
runZonedGuarded<Future<void>>(
() async {
WidgetsFlutterBinding.ensureInitialized();
await initializeMonitoringPackage(DefaultFirebaseOptions.currentPlatform);
FlutterError.onError = errorReportingService.recordFlutterError;
Isolate.current.addErrorListener(
RawReceivePort((pair) async {
final List<dynamic> errorAndStacktrace = pair;
await errorReportingService.recordError(
errorAndStacktrace.first,
errorAndStacktrace.last,
);
}).sendPort,
);
runApp(const GolekTruk());
},
(error, stack) => errorReportingService.recordError(
error,
stack,
fatal: true,
),
);
}

View File

@ -0,0 +1,264 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
auto_size_text:
dependency: transitive
description:
name: auto_size_text
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
component_library:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.0"
device_frame:
dependency: transitive
description:
name: device_frame
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_localizations:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
freezed_annotation:
dependency: transitive
description:
name: freezed_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.7.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.4"
recase:
dependency: transitive
description:
name: recase
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
storybook_flutter:
dependency: "direct main"
description:
name: storybook_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0"
sdks:
dart: ">=2.18.0 <3.0.0"
flutter: ">=2.11.0-0.1.pre"

View File

@ -0,0 +1,9 @@
import 'package:firebase_core/firebase_core.dart';
export 'src/analytics_service.dart';
export 'src/error_reporting_service.dart';
export 'src/explicit_crash.dart';
export 'src/remote_value_service.dart';
Future<void> initializeMonitoringPackage(FirebaseOptions? options) =>
Firebase.initializeApp(options: options);