formx_sdk_flutter 1.0.4 copy "formx_sdk_flutter: ^1.0.4" to clipboard
formx_sdk_flutter: ^1.0.4 copied to clipboard

A Flutter plugin for using FormX SDK in iOS and Android applications.

example/lib/main.dart

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

import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:formx_sdk_flutter/formx_sdk_flutter.dart';
import 'package:formx_sdk_flutter_example/screens/camera_screen.dart';
import 'package:formx_sdk_flutter_example/screens/extraction_screen.dart';
import 'package:formx_sdk_flutter_example/screens/home_screen.dart';
import 'package:formx_sdk_flutter_example/screens/preview_image_screen.dart';
import 'package:formx_sdk_flutter_example/screens/sdk_methods_demo_screen.dart';
import 'package:go_router/go_router.dart';

Future<void> main() async {
  await dotenv.load();

  final apiHost = dotenv.maybeGet("FORMX_API_HOST", fallback: "")!;
  await FormXSDK.init(
    extractorId: dotenv.env["FORMX_EXTRACTOR_ID"] ?? "<FILL_IN_EXTRACTOR_ID>",
    accessToken: dotenv.env["FORMX_ACCESS_TOKEN"] ?? "<FILL_IN_ACCESS_TOKEN>",
    apiHost: apiHost.isNotEmpty ? apiHost : null,
  );
  runApp(const MyApp());
}

final _router = GoRouter(routes: [
  GoRoute(path: "/", builder: (_, __) => const HomeScreen()),
  GoRoute(
    path: "/sdk_demo",
    builder: (_, __) => const SDKMethodsDemoScreen(),
  ),
  GoRoute(
    path: "/camera",
    builder: (_, __) => const CameraScreen(),
  ),
  GoRoute(
    path: "/preview",
    builder: (_, state) => PreviewImageScreen(state.extra as Uri),
  ),
  GoRoute(
    path: "/extraction",
    builder: (_, state) => ExtractionScreen(state.extra as Uri),
  ),
]);

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerConfig: _router,
    );
  }
}
2
likes
150
pub points
0%
popularity

Publisher

verified publisherformx.ai

A Flutter plugin for using FormX SDK in iOS and Android applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on formx_sdk_flutter