ios_device_check 2.0.0+1 copy "ios_device_check: ^2.0.0+1" to clipboard
ios_device_check: ^2.0.0+1 copied to clipboard

discontinued
PlatformiOS

Flutter plugin for accessing the iOS DeviceCheck. Only supported on iOS 11.0 or newer.

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(MyApp());

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => MyAppState();
}

class MyAppState extends State<MyApp> {
  dynamic _result;

  @override
  void initState() {
    super.initState();
    _generateToken();
  }

  void _generateToken() async {
    if (!(await IosDeviceCheck.isSupported())) {
      setState(() => _result = 'Not supported');
      return;
    }

    try {
      String token = await IosDeviceCheck.generateToken();
      setState(() => _result = token);
    } on PlatformException catch (e) {
      setState(
          () => _result = '[Error]: ${e.code} / ${e.message} / ${e.details}');
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('IosDeviceCheck Plugin Example'),
        ),
        body: SafeArea(
          child: Column(
            children: [
              Expanded(
                flex: 8,
                child: Container(
                  decoration: BoxDecoration(border: Border.all()),
                  margin: EdgeInsets.all(8),
                  padding: EdgeInsets.all(8),
                  child: SingleChildScrollView(
                    child: Text('${_result ?? ''}'),
                  ),
                ),
              ),
              Flexible(
                flex: 2,
                child: ElevatedButton(
                  child: Text('generateToken'),
                  onPressed: _generateToken,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
7
likes
160
points
38
downloads

Publisher

verified publishernaokiokada.com

Weekly Downloads

Flutter plugin for accessing the iOS DeviceCheck. Only supported on iOS 11.0 or newer.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on ios_device_check