altid_mobile 0.0.1
altid_mobile: ^0.0.1 copied to clipboard

A new flutter plugin project.

example/lib/main.dart

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

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

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

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

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

  @override
  void initState() {
    super.initState();
    initConnection();
    initDocument();
    initTitle();
  }

  Future<void> initConnection() async {
    try {
      await AltidMobile.altidStart("192.168.0.116");
    } on PlatformException {
    }

    try {
      await AltidMobile.altidAttach;
    } on PlatformException {}
  }

  Future<void> initDocument() async {
    String document;
    try {
      document = await AltidMobile.altidDocument;
    } on PlatformException {
      document = 'Failed to read document.';
    }

    setState(() {
      _document = document;
    });
  }

  Future<void> initTitle() async {
    String title;
    try {
      title = await AltidMobile.altidTitle;
    } on PlatformException {
      title = 'Failed to read title.';
    }

    setState(() {
      _titleData = title;
    });
  }


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text(_titleData),
        ),
        body: Center(
          child: Text(_document),
        ),
      ),
    );
  }
}
0
likes
70
pub points
0%
popularity

Publisher

Unknown

A new flutter plugin project.

Homepage

Documentation

API reference

License

LICENSE

Dependencies

flutter

More

Packages that depend on altid_mobile