loplat_plengi 1.0.1 copy "loplat_plengi: ^1.0.1" to clipboard
loplat_plengi: ^1.0.1 copied to clipboard

outdated

loplat plengi(Place Engine) SDK plugin project.

loplat_plengi #

loplat plengi(Place Engine) SDK plugin project.

Supported platforms #

  • Flutter Android
  • Flutter iOS
Android iOS Linux macOS Web Windows
Support SDK 16+ 9.0+ - - - -

Usage #

To use this plugin, add loplat_plengi as a dependency in your pubspec.yaml file.

Examples #

Here are small examples that show you how to use the API.

Recieve location data

To see detail location data, please visit loplat developer site.

import 'dart:isolate';
import 'dart:ui';

/// The name associated with the UI isolate's [SendPort].
const String isolateName = 'isolate';

/// A port used to communicate from a background isolate to the UI isolate.
final ReceivePort port = ReceivePort();

Future<void> main() async {
  /// Register the UI isolate's SendPort to allow for communication from the background isolate.
  IsolateNameServer.registerPortWithName(
    port.sendPort,
    isolateName,
  );

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static SendPort? uiSendPort;

  @override
  void initState() {
    super.initState();
    /// Listen location infomations from background
    LoplatPlengiPlugin.setListener(callback);
    initPlatformState();
  }

  // The callback for loplat plegni, msg is JSON String.
  static Future<bool> callback(String msg) async {
    print('result: $msg');

    // This will be null if we're running in the background.
    uiSendPort ??= IsolateNameServer.lookupPortByName(isolateName);
    uiSendPort?.send(null);
    return true;
  }
}
3
likes
0
points
236
downloads

Publisher

unverified uploader

Weekly Downloads

loplat plengi(Place Engine) SDK plugin project.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on loplat_plengi

Packages that implement loplat_plengi