smartlook 0.0.8

  • Readme
  • Changelog
  • Example
  • Installing
  • 82

smartlook #

Flutter plugin for Smartlook SDK

Getting Started #

Information about API: https://smartlook.github.io/docs/sdk/

0.0.8 #

  • Additional API methods
  • Minor fixes
  • Video rendering optimization

0.0.7 #

  • Image quality boost
  • Fix of rare orientation handling issues
  • Minor fixes

0.0.6 #

  • Custom API client
  • Touch/selector events are more reliable
  • Improved sensitive view hiding

0.0.5 #

  • fixed: iOS plugin build issues in Swift-based apps

0.0.4 #

  • Minor bugfixes.

0.0.3 #

  • Beta release of the plugin and minor bugfixes.

0.0.2 #

  • Additional methods for events recording

0.0.1 #

  • Initial testing version of Flutter wrapper for Smartlook

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:smartlook/smartlook.dart';
import 'dart:collection';

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  String _timeString;

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

    initPlatformState();
    
    _timeString = "${DateTime.now().hour} : ${DateTime.now().minute} :${DateTime.now().second}";
    Timer.periodic(Duration(seconds:1), (Timer t)=>_getCurrentTime());
    
    Smartlook.setupAndStartRecording('API_KEY');

    // calling all functions to make sure nothing crashes
    Smartlook.setUserIdentifier('FlutterLul', { "flutter-usr-prop" : "valueX"});
    Smartlook.setGlobalEventProperty("key_", "value_", true);
    Smartlook.setGlobalEventProperties( { "A" : "B"}, false);
    Smartlook.removeGlobalEventProperty("A");
    Smartlook.removeAllGlobalEventProperties();
    Smartlook.setGlobalEventProperty("flutter_global", "value_", true);
    Smartlook.enableWebviewRecording(true);
    Smartlook.enableWebviewRecording(false);
    Smartlook.enableCrashlytics(true);
    Smartlook.setReferrer("referer", "source");
    Smartlook.getDashboardSessionUrl();
  }

  void _getCurrentTime()  {
    setState(() {
    _timeString = "${DateTime.now().hour} : ${DateTime.now().minute} :${DateTime.now().second}";
    });
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await Smartlook.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          //child: Text('Running on: $_platformVersion\n'),

          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[

            Image.asset("lib/Smartlook.png"),

            Text(_timeString, style: TextStyle(fontSize: 18),),

            const SizedBox(height: 15),
            RaisedButton(
              onPressed: () {
                Smartlook.stopRecording();
              },
              child: Text('Stop recording'),
            ),
            RaisedButton(
              onPressed: () {
                Smartlook.startRecording();
              },
              child: Text('Start recording'),
            ),

            const SizedBox(height: 15),
            RaisedButton(
              onPressed: () {
                Smartlook.startTimedCustomEvent("timed-event");
              },
              child: Text('Start timed event'),
            ),
            RaisedButton(
              onPressed: () {
                Smartlook.trackCustomEvent("timed-event", { "property1" : "value1" });
              },
              child: Text('Track event'),
            ),

            const SizedBox(height: 15),
            RaisedButton(
              onPressed: () {
                Smartlook.startFullscreenSensitiveMode();
              },
              child: Text('Start Sensitive Mode'),
            ),
            RaisedButton(
              onPressed: () {
                Smartlook.stopFullscreenSensitiveMode();
              },
              child: Text('Stop Sensitive Mode'),
            ),

            const SizedBox(height: 15),
            RaisedButton(
              onPressed: () {
                Smartlook.trackNavigationEvent("nav-event", SmartlookNavigationEventType.enter);
              },
              child: Text('Enter Navigation Event'),
            ),
            RaisedButton(
              onPressed: () {
                Smartlook.trackNavigationEvent("nav-event", SmartlookNavigationEventType.exit);
              },
              child: Text('Exit Navigation Event'),
            ),
              
            ],
          ),
        ),      
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  smartlook: ^0.0.8

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:smartlook/smartlook.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Apr 6, 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 issues and suggestions

Document public APIs. (-1 points)

30 out of 30 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/smartlook.dart. (-2.48 points)

Analysis of lib/smartlook.dart reported 5 hints:

line 24 col 54: Don't explicitly initialize variables to null.

line 43 col 60: Don't explicitly initialize variables to null.

line 48 col 57: Don't explicitly initialize variables to null.

line 52 col 74: Don't explicitly initialize variables to null.

line 56 col 53: Don't explicitly initialize variables to null.

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.

Dependencies

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
flutter_test