fluttersdkplugin 0.0.1 copy "fluttersdkplugin: ^0.0.1" to clipboard
fluttersdkplugin: ^0.0.1 copied to clipboard

outdated

Plug-ins first gained popularity in the 1990s as software and microprocessors became more powerful. One of the first programs to make extensive use of plug-ins was Adobe Photoshop, an image-processing [...]

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:fluttersdkplugin/fluttersdkplugin.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  TextEditingController controller1=TextEditingController();
  String _platformVersion = 'Unknown',token="NULl";
  int notificationCount=0;
  final methodChannel=const MethodChannel("fluttersdkplugin");
  final _fluttersdkpluginPlugin = Fluttersdkplugin();
  late String cid;
  passLocation(){
    double lat=13.0827;
    double lang=  80.2707;
    _fluttersdkpluginPlugin.pushLocation(lat, lang);
  }
  newNotification(){
    var notificationTitle="sample Title";
    var notificationBody="sample BOdy";
    _fluttersdkpluginPlugin.addNewNotification(notificationTitle,notificationBody);
  }
  ontrackEvent(){
    var content="On Track Event called!!!";
    _fluttersdkpluginPlugin.onTrackEvent(content);
  }
  deleteNotificationByCampaignid(){
    setCidState();
    _fluttersdkpluginPlugin.deleteNotificationByCampaignId(cid);
  }
  setCidState(){
    setState(() {
      cid=controller1.text;

    });
  }
  readnotification(){
    setCidState();
    _fluttersdkpluginPlugin.readNotification(cid);
  }
  unreadNotification(){
    setCidState();
    _fluttersdkpluginPlugin.unReadNotification(cid);
  }
  appconversionTracking(){
    _fluttersdkpluginPlugin.appConversionTracking();
  }
  formdataCapture(){
    Map param = {
      "Name": "vishwa",
      "EmailID": "[email protected]",
      "MobileNo": 9329222922,
      "Gender": "Male",
      "formid": 101, // required
      "apikey": "e37315c0-8578-4bd2-a38a-cbba5dba8110",
      "City":"Chennai"// required
    };
    String formData = jsonEncode(param);
    _fluttersdkpluginPlugin.formDataCapture(formData);
  }
  updatepushToken(){
    _fluttersdkpluginPlugin.updatePushToken(token);
  }
  ondeviceRegister(){
    _fluttersdkpluginPlugin.onDeviceUserRegister('123','vishwa','24','[email protected]','9893839383','Male',token,'www.google.com','2/8/2005','BE',true,false);
  }
  getdeepLinkData() {
    _fluttersdkpluginPlugin.deepLinkData();
  }
  Future<int?> readnotificationCount() async{
    var nCount=await _fluttersdkpluginPlugin.readNotificationCount()!;
    setState(()  {
      notificationCount=nCount!;
    });
    if (kDebugMode) {
      print(notificationCount);
    }
    return null;
  }
  
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // 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 _fluttersdkpluginPlugin.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;
    });
  }
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          resizeToAvoidBottomInset: true,
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: SingleChildScrollView(
            child: ConstrainedBox(
              constraints: const BoxConstraints(),
              child:
              Container(
                child: Column(
                  children: [
                    Center(
                      child: Text('Running on: $_platformVersion\n'),
                    ),
                    ElevatedButton(onPressed: () {
                      passLocation();
                    }, child: Text("Push Location"),),
                    ElevatedButton(onPressed: () {
                      newNotification();
                    }, child: Text("Add New Notification"),),
                    ElevatedButton(onPressed: () {
                      ontrackEvent();
                    }, child: Text("On Track Event"),),
                    TextField(
                      controller: controller1,
                      onTap: () {
                        setState(() {});
                      },
                      keyboardType: TextInputType.number,
                      decoration: InputDecoration(
                          labelText: "Enter ID",

                          border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20))),),
                    ElevatedButton(onPressed: () {
                      deleteNotificationByCampaignid();
                    }, child: Text("delete Notification By Campaignid"),),
                    ElevatedButton(onPressed: () {
                      readnotification();
                    }, child: Text("read Notification"),),
                    ElevatedButton(onPressed: () {
                      appconversionTracking();
                    }, child: Text("app Conversion Tracking"),),
                    ElevatedButton(onPressed: () {
                      formdataCapture();
                    }, child: Text("form Data Capture"),),
                    ElevatedButton(onPressed: () {
                      readnotificationCount();
                    }, child: Text("read Notification Count"),),
                    ElevatedButton(onPressed: () {
                      updatepushToken();
                    }, child: Text("update Push Token"),),
                    ElevatedButton(onPressed: () { //
                      ondeviceRegister();
                    }, child: Text("On Device User Register"),),
                    ElevatedButton(onPressed: () {
                      getdeepLinkData();
                    }, child: Text("Get deepLinkData"),),
                    ElevatedButton(onPressed: () {
                      unreadNotification();
                    }, child: Text("un Read Notification"),)
                  ],
                ),
              ),
            ),
          ),)
    );
  }
}
0
likes
0
points
20
downloads

Publisher

unverified uploader

Weekly Downloads

Plug-ins first gained popularity in the 1990s as software and microprocessors became more powerful. One of the first programs to make extensive use of plug-ins was Adobe Photoshop, an image-processing and editing program. Early plug-ins provided enhanced functions such as special effects, filters, and other options for manipulating images within Photoshop.gin package which will be very u

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on fluttersdkplugin

Packages that implement fluttersdkplugin