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

A new Flutter Themis project.

example/lib/main.dart

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

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

void main() {

  FlutterThemis.InitReportException(() {
    runApp(const MyApp());
    print("测试打印输出,开始初始化themis");
    FlutterThemis.InitTHEMISWithID("7kGMO46uOiavSerPxohA678C6/Ic7COmrntqZcOq+FzNChroQXmCSV+9rkRNAmkqiozhefpnO6DezUo6XMgT5V8JPj9XJ769UHbikaRhw8CvDu2ehdOopEpGcFFVxruB5NxO20hyAhRp8Sg0am7oicTX4PrY+4SX1mFm08fvrXrtVVANMnrSW9zed4NH0gyL48GI7JIcyeaQqRv3qNE6xUiRWWY6XvAgKRyA1puzWZsZvJT0zcFL2AKf86nN6Mjhw66P0gY3UF9IPknW3C6eGl+cpfXnNk/68NOkFlr1RBwLd0PgRu2IlDG40FakmIC9mZtA/rvQpfHmpHB0Cu11ilxusUyBPj+g7L3M+m6culC/AuvyHOwjpq57amXDqvhcOguYmkPRwzXjYBoAyXvVeYqM4Xn6Zzug3s1KOlzIE+Vp5HABZYFG3hZF04Vs65Uf1XJXBiMFBE6Tk4+M+Ya7Dl1QV0pJTENG");
    print("测试打印输出,初始化themis 结束");
  },type: 2,isSync: true);

}

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlatformState();

    Future.delayed(Duration(milliseconds: 6000), () {
      print("延时1秒执行");
      FlutterThemis.AddCustomField("PlayerInfo", "my id");
      FlutterThemis.AddCustomField("GameScene", "12313123");

      FlutterThemis.AddCustomField("自定义key1", "自定义value1");

      FlutterThemis.AddCustomField("自定义key2", "自定义value2");

      FlutterThemis.ReportCustomMessage("添加消息");
      FlutterThemis.ReportCustomMessageWithTag("flutter MessageWithTag测试name", "flutter MessageWithTag测试 reason", "flutter MessageWithTag测试 message", 1, false);
      FlutterThemis.ReportException("flutter 测试name", "flutter 测试 reason", "flutter 测试 message", 1, false);
    });


    Future.delayed(Duration(milliseconds: 8000), () {
      List testList = [];

      var s = testList[3];

      print("==============$s");

    });

  }

  // 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 FlutterThemis.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(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_platformVersion\n'),
        ),
      ),
    );
  }
}
0
likes
120
points
20
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter Themis project.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_themis

Packages that implement flutter_themis