ios_device_check 0.0.3 copy "ios_device_check: ^0.0.3" to clipboard
ios_device_check: ^0.0.3 copied to clipboard

discontinued
outdated

Flutter plugin for iOS DeviceCheck.

example/lib/main.dart

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

void main() => runApp(new MyApp());

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

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

  @override
  initState() {
    super.initState();
    generateToken();
  }

  generateToken() async {
    String token;

    try {
      token = await IosDeviceCheck.generateToken();
    } on PlatformException {
      token = 'Failed to generateToken.';
    }

    if (!mounted)
      return;

    setState(() {
      _token = token;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        body: new SingleChildScrollView(
          padding: new EdgeInsets.all(10.0),
          child: new Text(_token),
        ),
        floatingActionButton: new FloatingActionButton(
          onPressed: generateToken,
          child: new Icon(Icons.refresh)
        ),
      ),
    );
  }
}