test_package_ashish 0.0.5 test_package_ashish: ^0.0.5 copied to clipboard
This is TestPackage SDK developed by Ashish.
Test Package SDK #
Introduction #
Flutter SDK is a powerful framework developed by Google for building cross-platform mobile applications with a focus on providing a secure development environment. With its robust security features, Flutter ensures that your application data and user information remain protected from potential threats and vulnerabilities.
Installation #
To install the Test Package SDK in your Flutter project, follow these simple steps:
- Open your project's
pubspec.yaml
file. - Add the following dependency under the
dependencies
section:
dependencies:
test_package_sdk: ^1.0.0
Make sure to replace ^1.0.0
with the latest version of the Test Package SDK.
-
Save the pubspec.yaml file.
-
Run the following command in your terminal:
flutter pub get
This command will fetch and download the Test Package SDK package into your project.
Import the Test Package SDK in your Dart code:
import 'package:test_package_sdk/test_package_sdk.dart';
You're now ready to start using the Test Package SDK in your application.
Note: Ensure that your Flutter SDK is up to date and compatible with the version of Test Package SDK you are installing. For more detailed installation instructions or troubleshooting, refer to the official documentation or reach out to the Test support team.
Usage #
Implementation
To implement Test Package SDK in your main.dart file, use the following code:
@override
void initState() {
initPlatformState();
if (Platform.isAndroid) {
TestPackage.configure(
"your secret key");
} else if (Platform.isIOS) {
TestPackage
.configure(" your iOS secret key ");
}
super.initState();
}
Request Token
To fetch the request token for login, use the following method:
TestPackage.getRequestTokenForLogin();
Event Monitoring: #
1. Application Event
TestPackage manages application events itself. If, somehow, the app event is not getting generated, you can use the following method:
TestPackage.trackAppEvent(appstate);
2. Screen Change Event
To track screen change events, add the following line to your code:
navigatorObservers: [TestPackage.trackScreenChangeEvent()],
Example:
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
navigatorObservers: [TestPackage.trackScreenChangeEvent()],
home: const MainScreen(),
routes: {
'main': (context) => const MainScreen(),
'login': (context) => const LoginScreen(),
'register': (context) => const RegisterScreen(),
'location': (context) => const LocationPage(),
'click_event': (context) => const ClickEventTestPage(),
'screen_one': (context) => const ScreenOne(),
'screen_two': (context) => const ScreenTwo(),
'screen_three': (context) => const ScreenThree(),
'screen_four': (context) => const ScreenFour(),
},
);
}
}
If your project doesn’t support navigatorObservers then you can use custom below method.
TestPackage.trackScreenChangeEvent(currentScreenName);
3. Click Event
To track click events, use the following method:
TestPackage.trackClickEvent(context,position);
Example:
import 'package:test_package/test_package.dart';
import 'package:flutter/material.dart';
class ClickEventTestPage extends StatefulWidget {
const ClickEventTestPage({Key? key}) : super(key: key);
@override
State<ClickEventTestPage> createState() => _ClickEventTestPageState();
}
class _ClickEventTestPageState extends State<ClickEventTestPage> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTapDown: (position) {
setState(() {
TestPackage.trackClickEvent(context,position);
});
},
child: Scaffold(
appBar: AppBar(
title: const Text('Click Event Test Page'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 16.0),
const Text(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
style: TextStyle(fontSize: 18.0),
),
const SizedBox(height: 32.0),
ElevatedButton(
onPressed: () {},
child: const Text('Button 1'),
),
const SizedBox(height: 16.0),
ElevatedButton(
onPressed: () {},
child: const Text('Button 2'),
)]
);
}
}