packet_ios_sdk 1.0.3 copy "packet_ios_sdk: ^1.0.3" to clipboard
packet_ios_sdk: ^1.0.3 copied to clipboard

PlatformiOS

this is a ios sdk.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:packet_ios_sdk/packet_ios_sdk.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _packetIosSdkPlugin = PacketIosSdk();

  @override
  void initState() {
    super.initState();
    initPlatformState();
    // setkey();
    //stopconnect();
  }

  Future<void> setkey() async {
    try {
  await _packetIosSdkPlugin.SetAppKey("yourappkey");
  } catch (e) {
      print('Error setting app key: $e');
  }
  }

  Future<void> stopconnect() async {
    try{
      await _packetIosSdkPlugin.Stop();
    } catch(e) {
      print('Error stop: $e');
    }
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {

    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null

    // 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(() {
     
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          // child: Text('Running on: $_platformVersion\n'),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: setkey,
                child: Text('startSdk'),
              ),
              ElevatedButton(
                onPressed: stopconnect,
                child: Text('stopSdk'),
              ),
              
            ],
          )
          
        
        ),
      ),
    );
  }
}
0
likes
140
points
41
downloads

Publisher

verified publisherpacketsdk.com

Weekly Downloads

this is a ios sdk.

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on packet_ios_sdk