geo_sdk_flutter_plugin 0.0.2+35

  • Readme
  • Changelog
  • Example
  • Installing
  • 44

geo_sdk_flutter_plugin #

A plugin to wrap the GeoSDK

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0.0.2 #

Improves log messages

0.0.1 #

  • TODO: Describe initial release.


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

import 'package:flutter/services.dart';
import 'package:geo_sdk_flutter_plugin/geo_sdk_plugin.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {

  GeoSdkFlutterPlugin _geoSdkFlutterPlugin;

  List<LDEvent> _ldEventLogList = List();

  String _sdkVersion = '';
  LDEvent _lastEvent;
  int _payloadSentCount = 0;

  void initState() {

    SchedulerBinding.instance.addPostFrameCallback((_) {

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> startEvents() async {

    try {
    } on PlatformException {
      print('Failed to launch the SDK.');


  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            backgroundColor: Color(0xff103a72),
            title: const Text('GeoSDK Flutter Plugin Example'),
            centerTitle: true,
          body: Column(
            children: <Widget>[

                alignment: Alignment.topCenter,
                child: Padding(
                  padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
                  child: Card(
                    child: Padding(
                      padding: EdgeInsets.symmetric(vertical: 20, horizontal: 10),
                      child: Column(
                        children: <Widget>[
                            style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
                            'GeoSDK is on version: $_sdkVersion',
                            style: TextStyle(fontSize: 17),
                            'Total payload sent count: $_payloadSentCount',
                            style: TextStyle(fontSize: 17),
                            'The last event caught by the SDK was: ${_lastEvent?.type}',
                            style: TextStyle(fontSize: 17),

                padding: EdgeInsets.symmetric(horizontal: 20),
                child: Divider(thickness: 1,),
                'Event log:',
                style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
                  shrinkWrap: true,
                  itemCount: _ldEventLogList.length,
                  itemBuilder: (context, index) {
                    return Center(
                      child: Padding(
                        padding: EdgeInsets.symmetric(vertical: 10),
                        child: Text(_ldEventLogList[index].type.toString(), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),),
                ) ,

                alignment: Alignment.bottomCenter,
                child: Container(
                  padding: EdgeInsets.symmetric(vertical: 20),
                  child: Text('This plugin is powered by LOTaDATA Inc', style: TextStyle(fontSize: 14),),


  Future<void> _initGeoSdkPlugin() async {
    _geoSdkFlutterPlugin = new GeoSdkFlutterPlugin();

    bool launchResult = await _geoSdkFlutterPlugin.checkPermissionsAndLaunch();
    print('MAIN: launchResult is $launchResult');

    LDEvent lastLDEvent = await _geoSdkFlutterPlugin.getLastEvent;
    String sdkVersion = await _geoSdkFlutterPlugin.getSDKVersion;

    setState(() {
      this._sdkVersion = sdkVersion;
      this._lastEvent = lastLDEvent;

  void onPayloadSent(int count) {
    setState(() {
      this._payloadSentCount = count;

  void onEventHandler(LDEvent ldEvent) {
    print('MAIN: onEventHandler triggered Type: ${ldEvent.type}');

    setState(() {

  void dispose() {


Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  geo_sdk_flutter_plugin: ^0.0.2+35

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:geo_sdk_flutter_plugin/geo_sdk_flutter_plugin.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/geo_sdk_flutter_plugin.dart. (-0.50 points)

Analysis of lib/geo_sdk_flutter_plugin.dart reported 1 hint:

line 3 col 8: Unused import: 'package:flutter/cupertino.dart'.

Format lib/geo_sdk_plugin.dart.

Run flutter format to format lib/geo_sdk_plugin.dart.

Format lib/models/ld_event.dart.

Run flutter format to format lib/models/ld_event.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies