tinstall_flutter_plugin 0.0.9 icon indicating copy to clipboard operation
tinstall_flutter_plugin: ^0.0.9 copied to clipboard

A new Flutter plugin.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:tinstall_flutter_plugin/tinstall_flutter_plugin.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
  String _appCode = "{}";

  @override
  void initState() {
    super.initState();
    // initInstallSetHost();
    initInstall();
    getWithInstallResult();
    installUserRegister();
    // installUserRegisterId();
  }

  //安装
  Future<void> initInstall() async {
    await TinstallFlutterPlugin.init('10VB57QR');
  }

  //设置host
  Future<void> initInstallSetHost() async {
    await TinstallFlutterPlugin.setHost('https://54youyuan.cn/');
  }

  //获取参数
  Future<void> getWithInstallResult() async {
    String code;
    try {
      code = (await TinstallFlutterPlugin.getInstall())!;
    } on PlatformException {
      code = "{}";
    }
    if (!mounted) return;
    setState(() {
      print("ios 4: $code");
      _appCode = code;
    });
  }

  //注册
  Future<void> installUserRegister() async {
    await TinstallFlutterPlugin.registered();
  }

  //注册
  Future<void> installUserRegisterId() async {
    await TinstallFlutterPlugin.registeredId("10");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on:  $_appCode\n'),
        ),
      ),
    );
  }
}
0
likes
110
pub points
0%
popularity

Publisher

unverified uploader

A new Flutter plugin.

Homepage

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on tinstall_flutter_plugin