How to debug a Custom Widget loading a flutter plugin/SDK easiest?

Custom Code

Hi all ๐Ÿ‘‹, I want to integrate the "anyline SDK" (www.anyline.com) in my Flutterflow project as a "Custom Widget" so that I can scan barcodes with the camera. For some the app crashes on android every time I try to open the bottom sheet which should load the anyline SDK.

I have the following code:

// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:anyline_plugin/anyline_plugin.dart';

class AnylineScanner extends StatefulWidget {
  const AnylineScanner({
    super.key,
    this.width,
    this.height,
    this.keyAnyline,
    this.config,
  });

  final double? width;
  final double? height;
  final String? keyAnyline;
  final String? config;

  @override
  State<AnylineScanner> createState() => _AnylineScannerState();
}

class _AnylineScannerState extends State<AnylineScanner> {
  late AnylinePlugin _anylinePlugin;

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

  Future<void> _initializeSdk() async {
    if (widget.keyAnyline == null) {
      print("Error: License key is null.");
      return;
    }

    _anylinePlugin = AnylinePlugin();
    try {
      await _anylinePlugin.initSdk(widget.keyAnyline!);
      print("Anyline SDK initialized successfully.");
    } catch (error) {
      print("Error initializing Anyline SDK: $error");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: widget.width ?? double.infinity,
      height: widget.height ?? double.infinity,
      // Add your scanner UI or functionality here
    );
  }
}

Maybe I'm doing something super obvious wrong in the code?

Here's more info about the Anyline plugin: https://documentation.anyline.com/flutter-plugin-component/latest/getting-started.html

I'm not sure if I can test whether it works on my desktop, because it uses the camera. On desktop (Test Session) it doesn't crash at least.

On my Android phone I don't know how to debug it best. Where can I find the print() statements for instance?

Haven't tested it on iOS yet.

Thanks for every help or suggestion. ๐Ÿ™

What have you tried so far?

I've tried all kind of combinations in the code.
Code compiles in Flutterflow.
Have been reaching out to Anyline support
Tried the developer tools in Google Chrome to see if there are some hints.
Googled Flutterflow and Anyline integrations.
Checked the community here.

Did you check FlutterFlow's Documentation for this topic?
Yes
1