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

A sdk to interact with the Snipe API.

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:snipesdk/snipe_sdk_flutter.dart';

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

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',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Snipe SDK'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  SnipeSdk snipeSdk = SnipeSdk();

  @override
  Widget build(BuildContext context) {
    // snipeSdk.init("dev_MTYyNjFlOWUtNmUyZS00ZTU2LTg5MGQtZDVlNzVjMjI3YWE1");
    snipeSdk.init("dev_MTYyNjFlOWUtNmUyZS00ZTU2LTg5MGQtZDVlNzVjMjI3YWE1");

    // snipeSdk.signUp("hellooootestt");

    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
                onPressed: () async {
                  dynamic output = await snipeSdk.signUp("hellooootestt");
                  log(output.toString());
                  // } catch (e) {
                  //   log(e.toString());
                  // }
                },
                child: const Text("SignUp")),
            ElevatedButton(
                onPressed: () async {
                  try {
                    dynamic output = await snipeSdk.trackEvent(
                        eventId: "65437910a3c7c15ec19e27e8",
                        transactionAmount: 100,
                        snipeId: "65488b5eb10d88684b090833");
                    log(output.toString());
                  } catch (e) {
                    log(e.toString());
                  }
                },
                child: const Text("Track Event")),
            ElevatedButton(
                onPressed: () async {
                  dynamic output = await snipeSdk
                      .getTokenHistory("65488b5eb10d88684b090833");
                  log(output.toString());
                },
                child: const Text("Token History")),
            ElevatedButton(
                onPressed: () async {
                  dynamic output = await snipeSdk
                      .getTokenDetails("65488b5eb10d88684b090833");
                  log(output.toString());
                },
                child: const Text("Token Details")),
            ElevatedButton(
                onPressed: () async {
                  dynamic output =
                      await snipeSdk.getCoinData("65488b5eb10d88684b090833");
                  log(output.toString());
                },
                child: const Text("Coin Data")),
            ElevatedButton(
                onPressed: () async {
                  dynamic output =
                      await snipeSdk.getStreaks("65488b5eb10d88684b090833");
                  log(output.toString());
                },
                child: const Text("Streaks"))
          ],
        ),
      ),
    );
  }
}
2
likes
130
points
6
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A sdk to interact with the Snipe API.

Homepage

License

unknown (license)

Dependencies

flutter, http, video_player

More

Packages that depend on snipe_sdk_flutter