flutter_nemid 0.0.1
flutter_nemid: ^0.0.1 copied to clipboard

A Flutter plugin for NemID integration on Android and iOS

example/lib/main.dart

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

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

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

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

class _MyAppState extends State<MyApp> {
  bool _loggedIn = false;

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

  Future<void> initPlatformState() async {
    bool loggedIn;

    try {
      loggedIn = await FlutterNemid.startNemIDLogin;
    } on PlatformException {
      loggedIn = false;
    }

    if (!mounted) return;

    setState(() {
      _loggedIn = loggedIn;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('NemID login example app'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              RaisedButton(
                onPressed: initPlatformState,
                child: Text("NemID Login"),
              ),
              Text('Is logged in: $_loggedIn\n'),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
80
pub points
37%
popularity

A Flutter plugin for NemID integration on Android and iOS

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

michaelwestergaard@hotmail.dk

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_nemid