plug_bug 0.0.9
plug_bug: ^0.0.9 copied to clipboard
SDK and bmrt reports include video of user actions, network traffic, console logs and many other important traces from your app
example/lib/main.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:plug_bug/plug_bug.dart';
import 'package:plug_bug_example/post_api_cls.dart';
/*
void main() {
runApp(const MyApp());
}
*/
/*Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await launchBugsee((bool isBugseeLaunched) async {
runApp(const MyApp());
});
}
Future<void> launchBugsee(void Function(bool isBugseeLaunched) appRunner) async {
var bugseeToken = "";
if (Platform.isAndroid) {
bugseeToken = "0c56d0ba-a589-4aae-9f7d-519fdf4f680b";
} else if (Platform.isIOS) {
bugseeToken = "";
}
await PlugBug.launch(bugseeToken,appRunCallback: appRunner);
}*/
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await launchBugsee();
runApp(const MyApp());
}
Future<void> launchBugsee() async {
var bugseeToken = "";
if (Platform.isAndroid) {
bugseeToken = "0c56d0ba-a589-4aae-9f7d-519fdf4f680b";
} else if (Platform.isIOS) {
bugseeToken = "";
}
await PlugBug.launch(bugseeToken);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
navigatorObservers: [PlugBug.customRouteObserver],
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> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'BMRT LAUNCH',
),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MyHomePagePost()),
);
},
child: Text("Screen Navigatie"),
),
SizedBox(height: 100,),
Text('Running on1:'),
SizedBox(height: 100,),
Text('Running on1:'),
],
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
/*class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _plugBugPlugin = PlugBug();
Map<String, dynamic>? _deviceInfo;
bool _isLoading = true;
String? _error;
@override
void initState() {
super.initState();
_fetchDeviceInfo();
}
Future<void> _fetchDeviceInfo() async {
try {
final info = await PlugBug.getDeviceInfo();
setState(() {
_deviceInfo = info;
_isLoading = false;
});
} catch (e) {
setState(() {
_error = e.toString();
_isLoading = false;
});
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: _isLoading
? Center(child: CircularProgressIndicator())
: _error != null
? Center(child: Text('Error: $_error'))
: Column(
children: [
Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
if (_deviceInfo != null)
Text(
'Running on: ${_deviceInfo!['brand']} ${_deviceInfo!['model']} with version ${_deviceInfo!['version']}',
),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Screen2()),
);
},
child: Text("Screen Navigatie"),
),
SizedBox(height: 100),
Text('Running on1:'),
SizedBox(height: 100),
Text('Running on1:'),
],
),
),
],
),
),
);
}
}*/
/*Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await launchBugsee((bool isBugseeLaunched) async {
runApp(const MyApp());
});
}
Future<void> launchBugsee(void Function(bool isBugseeLaunched) appRunner) async {
var bugseeToken = "1c3d5a5a-3d65-4c39-95a9-05cbdd496437";
await PlugBug.launch(bugseeToken);
appRunner(true);
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _plugBugPlugin = PlugBug();
Map<String, dynamic>? _deviceInfo;
bool _isLoading = true;
String? _error;
@override
void initState() {
super.initState();
// initPlatformState();
_fetchDeviceInfo();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion =
await _plugBugPlugin.getPlatformVersion() ?? 'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
Future<void> _fetchDeviceInfo() async {
try {
final info = await PlugBug.getDeviceInfo();
setState(() {
_deviceInfo = info;
_isLoading = false;
});
} catch (e) {
setState(() {
_error = e.toString();
_isLoading = false;
});
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(10),
child:Column(
children:[
Text('Running on: ${_deviceInfo!['brand']} ${_deviceInfo!['model']} with version ${_deviceInfo!['version']}'),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Screen2()),
);
},
child: Text("Screen Navigatie"),
),
SizedBox(height: 100,),
Text('Running on1:'),
SizedBox(height: 100,),
Text('Running on1:'),
],
)
),
],
),
),
);
}
}*/