terra_flutter 2.0.0 copy "terra_flutter: ^2.0.0" to clipboard
terra_flutter: ^2.0.0 copied to clipboard

A flutter plug-in for the native Teko Terra library (Android and iOS).

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:terra_flutter/terra_app.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

class _MyAppState extends State<MyApp> {
  String _clientId = "";
  String _iamConfig = "";

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

  Future<void> initPlatformState() async {
    TerraApp terraApp;
    try {
      terraApp = await TerraApp.initTerraApp();
      _clientId = terraApp.clientId ?? "";
    } on Exception catch (err) {
      _clientId = err.toString();
    }

    try {
      final terraApp = TerraApp.getInstance(TerraApp.defaultAppName);
      final service = await terraApp.getServiceConfig(serviceName: "iam");
      _iamConfig = service.config ?? "";
    } on Exception catch (err) {
      _iamConfig = err.toString();
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            const Text("Client ID: "),
            Text(_clientId),
            const Text("IAM Config: "),
            Text(_iamConfig),
          ],
        ),
      ),
    );
  }
}
0
likes
120
points
577
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter plug-in for the native Teko Terra library (Android and iOS).

Repository

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on terra_flutter