flutter_login_yandex_updated 0.0.6 copy "flutter_login_yandex_updated: ^0.0.6" to clipboard
flutter_login_yandex_updated: ^0.0.6 copied to clipboard

Flutter plugin for authorization with Yandex LoginSDK for iOS and Android

example/lib/main.dart

import 'dart:io';

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

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  String _token = 'empty';
  final _flutterLoginYandexPlugin = FlutterLoginYandex();

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              Text('Token: $_token\n', textAlign: TextAlign.center),
              InkWell(
                onTap: () async {
                  final response = await _flutterLoginYandexPlugin.signIn();
                  if (response != null) {
                    setState(() {
                      if (response['token'] != null) {
                        _token = response['token'] as String;
                      } else {
                        _token = response['error'] as String;
                      }
                    });
                  }
                },
                child: const Padding(
                    padding: EdgeInsets.all(15), child: Text('Press')),
              ),
              if (Platform.isIOS)
                InkWell(
                  onTap: () async {
                    final response = await _flutterLoginYandexPlugin.signOut();
                    setState(() {
                      _token = '';
                    });
                  },
                  child: const Padding(
                      padding: EdgeInsets.all(15), child: Text('Sign Out')),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
140
pub points
34%
popularity

Publisher

unverified uploader

Flutter plugin for authorization with Yandex LoginSDK for iOS and Android

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_login_yandex_updated