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

G1 tracking's plugin

example/lib/main.dart

import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:one_target_mobile_sdk/one_target_mobile_sdk.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          leading: IconButton(
            icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
            onPressed: () {
              exit(0);
            },
          ),
          centerTitle: true,
          title: const Text('OneTargetMobileSDK'),
        ),
        body: ListView(
          padding: const EdgeInsets.all(16.0),
          physics: const BouncingScrollPhysics(),
          children: [
            SampleButton(
              text: "Sample Button",
              onPressed: () {
                _test();
              },
            ),
            FutureBuilder<String?>(
              future: SampleCallNativeFlutter.platformVersion,
              builder: (_, snapshot) {
                return Text(snapshot.data ?? '');
              },
            ),
          ],
        ),
      ),
    );
  }

  void _test() {
    SampleCallNativeFlutter.platformVersion.then((value) {
      if (kDebugMode) {
        print("platformVersion: $value");
      }
    });
  }
}