30
loading...
This website collects cookies to deliver better user experience
Please note that you must install Android Studio and configure the Android SDK, AVD Manager, as explained in the link mentioned above.
flutter doctor
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.16299.2166], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio
[√] VS Code, 64-bit edition (version 1.56.2)
[√] Connected device (1 available)
• No issues found!
tryIt
, and press Enter.main.dart
if it doesn’t open automatically.Chrome(web-javascript).
It will open a selection box to start the Android emulator. Select the mobile emulator option to launch it.Run
menu option and Start Debugging
.Please note, you must have the file main.dart
opened in the VS Code editor while you start debugging from the ‘Run’ menu option. Also, the first-time load of the application in the emulator may take a while.
build()
function of the MyApp
class in the main.dart
file:title
value Flutter Demo
to Flutter & Bugfender Demo
.primarySwatch
value from the color blue to pink (or whatever you like).MyHomePage
constructor, change the text from Flutter Demo Home Page
to Flutter & Bugfender Demo
.build()
function of the _MyHomePageState
class. First, please find and replace the text You have pushed the button this many times:
with We will log thecounterto Bugfender once you push it
.flutter pub add flutter_bugfender
pubspec.yaml
dependencies:
flutter_bugfender: ^2.0.0
flutter pub get
command. You can run this explicitly from the command prompt as well.main.dart
file using the following line.import 'package:flutter_bugfender/flutter_bugfender.dart';
Initialized Bugfender
when the app comes up for the first time. To do that, you can override the initState()
method of the _MyHomePageState
class like this:@override
initState() {
super.initState();
initPlatformState();
}
initPlatformState()
function. Here, we are initializing Bugfender using the API key we have created initially. Then we log a message:initPlatformState() async {
try {
await FlutterBugfender.init("BUGFENDER-API-KEY", enableAndroidLogcatLogging: false);
await FlutterBugfender.log("Initialized Bugfender");
} catch (e) {
print("Error found!!!! $e");
throw e;
}
if (!mounted) return;
}
Android SDK
under the Device
section.counter
by 1. How about we log this counter value? To do that, please go to the _incrementCounter()
method of the _MyHomePageState
class and add a log to the _counter
value.void _incrementCounter() {
setState(() {
_counter++;
});
FlutterBugfender.log('Value of the counter is $_counter');
}
sendFeedback
API to send feedback from the app. First, let’s add a feedback button.floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
FloatingActionButton(
child: Icon(
Icons.add
),
onPressed: _incrementCounter,
heroTag: null,
),
SizedBox(
height: 10,
),
FloatingActionButton(
child: Icon(
Icons.feedback
),
onPressed: _sendFeedback,
heroTag: null,
)
]
),
_sendFeedback
function.void _sendFeedback() {
FlutterBugfender.sendUserFeedback("User Feedback", "The app works very well!");
}
FEEDBACK
tab. You should find a section named ‘User Feedback’. This is the same feedback we have sent from the app.FloatingActionButton(
child: Icon(
Icons.bug_report
),
onPressed: _reportIssue,
heroTag: null,
)
_repotIssue
function. Here we first send an error log and then send an issue with the title and details.void _reportIssue() {
FlutterBugfender.error('Reporting issue');
FlutterBugfender.sendIssue("Issue Found", "We have found an issue in the counter");
}
ISSUES
tab. You should find the issue logged there. Please click on it to see the details.Bugfender
has many more API methods that you can use to send logs. Here is the list of the methods that we haven’t used in our app but you can try out.await FlutterBugfender.fatal("Fatal sent!");
await FlutterBugfender.error("Error sent!");
await FlutterBugfender.warn("Warning sent!");
await FlutterBugfender.info("Info sent!");
await FlutterBugfender.debug("Debug sent!");
await FlutterBugfender.trace("Trace sent!");
await FlutterBugfender.setDeviceString("user.email", "[email protected]");
await FlutterBugfender.setDeviceInt("user.id", 1);
await FlutterBugfender.setDeviceFloat("user.weight", 1.234);
await FlutterBugfender.setDeviceBool("user.team", true);
await FlutterBugfender.removeDeviceKey("user.team");
print(await FlutterBugfender.sendCrash("Test Crash", "Stacktrace here!"));
print(await FlutterBugfender.sendIssueMarkdown("Test Issue with markdown", "Issue _value_ **goes** here!"));
await FlutterBugfender.setForceEnabled(true);
await FlutterBugfender.setForceEnabled(false);
await FlutterBugfender.forceSendOnce();
print(await FlutterBugfender.getDeviceUri());
print(await FlutterBugfender.getSessionUri());