flutter_login_yandex_updated 0.0.9 copy "flutter_login_yandex_updated: ^0.0.9" to clipboard
flutter_login_yandex_updated: ^0.0.9 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_updated/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
  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.containsKey('token')) {
                        _token = response['token'] as String;
                      } else if (response.containsKey('error')) {
                        _token = response['error'] as String;
                      }
                    });
                  }
                },
                child: const Padding(
                  padding: EdgeInsets.all(15),
                  child: Text('Press'),
                ),
              ),
              if (Platform.isIOS)
                InkWell(
                  onTap: () async {
                    // ignore: unused_local_variable
                    final response = await _flutterLoginYandexPlugin.signOut();
                    setState(() => _token = '');
                  },
                  child: const Padding(
                    padding: EdgeInsets.all(15),
                    child: Text('Sign Out'),
                  ),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
160
points
1.98k
downloads

Publisher

unverified uploader

Weekly Downloads

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

Packages that implement flutter_login_yandex_updated