at_client_mobile 3.2.16 copy "at_client_mobile: ^3.2.16" to clipboard
at_client_mobile: ^3.2.16 copied to clipboard

A Flutter extension to the at_client library which adds support for mobile, desktop and IoT devices.


import 'dart:async';
import 'package:at_client_mobile_example/src/screens/home.dart';
import 'package:at_client_mobile_example/src/screens/login.dart';
import 'package:flutter/material.dart';
import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:path_provider/path_provider.dart'
    show getApplicationSupportDirectory;
import 'package:at_app_flutter/at_app_flutter.dart' show AtEnv;

Future<void> main() async {
  await AtEnv.load();
  runApp(const MyApp());

Future<AtClientPreference> loadAtClientPreference() async {
  var dir = await getApplicationSupportDirectory();
  return AtClientPreference()
    ..rootDomain = AtEnv.rootDomain
    ..namespace = AtEnv.appNamespace
    ..hiveStoragePath = dir.path
    ..commitLogPath = dir.path
    ..isLocalStoreRequired = true;

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  // * load the AtClientPreference in the background
  Future<AtClientPreference> futurePreference = loadAtClientPreference();
  AtClientPreference? atClientPreference;

  Widget build(BuildContext context) {
    return MaterialApp(
      // * The onboarding screen (first screen)
      routes: <String, Widget Function(BuildContext)>{ (BuildContext context) => const LoginScreen(), (BuildContext context) => const HomeScreen(),