# Send Debug Info

Last updated:

<!-- -->

October 18, 2026

<!-- -->

\| 2 minutes read

<br />

<br />

This example showcases how to build a Flutter app featuring an interactive map and how to share debug information as a .txt file, using the Maps SDK for Flutter.

## How it works[​](#how-it-works "Direct link to How it works")

The example app demonstrates the following features:

* Display an interactive map.
* Share debug logs.

![Initial map screen](/docs/flutter/assets/images/example_flutter_send_debug_info1-1cb50ec73c2abb2f078121fad2595f63.png)

**Initial map screen**

![Share menu open with .txt file](/docs/flutter/assets/images/example_flutter_send_debug_info2-b83f7ccdb4a3099d2069091f2a24cb06.png)

**Share menu open with .txt file**

### UI and Map Integration[​](#ui-and-map-integration "Direct link to UI and Map Integration")

The following code builds a UI with an interactive `GemMap` and a share button.

main.dart[View on Github](https://github.com/magiclane/magiclane-maps-sdk-examples-for-flutter/tree/main/send_debug_info/lib/main.dart?ref_type=heads#L16)

```dart
const projectApiToken = String.fromEnvironment('YOUR_API_TOKEN_HERE');

void main() async {
  // Turn on logging
  Debug.logCallObjectMethod = false;
  Debug.logCreateObject = true;
  Debug.logLevel = GemLoggingLevel.all;
  Debug.logListenerMethod = true;

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Send Debug Info',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void dispose() {
    GemKit.release();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.deepPurple[900],
        title: const Text(
          'Send Debug Info',
          style: TextStyle(color: Colors.white),
        ),
        actions: [
          IconButton(
            onPressed: _shareLogs,
            icon: const Icon(Icons.share, color: Colors.white),
          ),
        ],
      ),
      body: GemMap(
        key: ValueKey("GemMap"),
        appAuthorization: projectApiToken,
        onMapCreated: (ctrl) async {
          await Debug.setSdkDumpLevel(GemDumpSdkLevel.verbose);

          // Redirect Dart SDK logs to the SDK dump log file
          final dartSdkLogger = Logger('GemSdkLogger');
          dartSdkLogger.onRecord.listen((record) {
            Debug.log(
              level: GemDumpSdkLevel.verbose,
              message: '${record.time} ${record.message}',
            );
          });
        },
      ),
    );
  }

  Future<void> _shareLogs() async {
    // Get the path to the SDK log dump file
    final logPath = await Debug.sdkLogDumpPath;

    await SharePlus.instance.share(ShareParams(files: [XFile(logPath)]));
  }
}

```
