import 'package:flutter/services.dart'; class NativeUuidGenerator { static const MethodChannel _channel = MethodChannel('com.example/native_utils'); static Future generateRandomUUID() async { try { return await _channel.invokeMethod('generateRandomUUID'); } on PlatformException catch (e) { throw Exception("Failed to generate UUID: ${e.message}"); } } static Future generateTimeBasedUUID() async { try { return await _channel.invokeMethod('generateTimeBasedUUID'); } on PlatformException catch (e) { throw Exception("Failed to generate UUID: ${e.message}"); } } } /** * 1. https://mvnrepository.com/artifact/com.fasterxml.uuid/java-uuid-generator/4.0.1 * 2. add jars to app/libs, modify build.gradle.kts * 3. modify app/src/main/kotlin/com/example/include_jar/MainActivity.kt * 4. refer in flutter */