flutter_griffon 1.0.0-beta.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

flutter_griffon #

pub package Build License

⚠️ This package is currently in beta, we are actively working to a release candidate. If you have any feedback please log an issue or submit a pull request.

flutter_griffon is a flutter plugin for the iOS and Android Project Griffon SDK to allow for integration with Flutter applications. Functionality to enable the Griffon extension is provided entirely through Dart documented below.

Installation #

Install instructions for this package can be found here.

Note: After you have installed the SDK, don't forget to run pod install in your ios directory to link the libraries to your Xcode project.

Tests #

Run:

flutter test

Usage #

Griffon #

Importing the SDK:
import 'package:flutter_griffon/flutter_griffon.dart';
Getting Griffon version:
String version = FlutterGriffon.extensionVersion;
Starting a Griffon session:
FlutterGriffon.startSession(url);
Ending a Griffon session:
FlutterGriffon.endSession();
Attempt to reconnect to a Griffon session:
FlutterGriffon.attemptReconnect();
Sending a Griffon event:
FlutterGriffon.sendEvent("vendor", "type", {"customPayload": "customValue"});
Log Local UI Level:
import 'package:flutter_griffon/src/acpgriffon_uilogcolor.dart';

FlutterGriffon.logLocalUILevel(ACPGriffonUILogColor.VISIBILITY_LOW, "message");
FlutterGriffon.logLocalUILevel(ACPGriffonUILogColor.VISIBILITY_NORMAL, "message");
FlutterGriffon.logLocalUILevel(ACPGriffonUILogColor.VISIBILITY_HIGH, "message");
FlutterGriffon.logLocalUILevel(ACPGriffonUILogColor.VISIBILITY_CRITICAL, "message");

Contributing #

See CONTRIBUTING

License #

See LICENSE

1.0.0-beta.3 #

  • Fix install instructions.

1.0.0-beta.2 #

  • Metadata updates.

1.0.0-beta.1 #

  • Initial beta release.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:flutter_griffon/flutter_griffon.dart';
import 'package:flutter_acpcore/flutter_acpcore.dart';
import 'package:flutter_acpanalytics/flutter_acpanalytics.dart';
import 'package:flutter_griffon/src/acpgriffon_uilogcolor.dart';

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

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

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

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String griffonVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      griffonVersion = await FlutterGriffon.extensionVersion;
    } on PlatformException {
      log("Failed to get extension versions");
    }

    // 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 = griffonVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ListView(shrinkWrap: true, children: <Widget>[
            Text('ACPGriffon version = $_platformVersion\n'),
            RaisedButton(
              child: Text("ACPCore.trackState(...)"),
              onPressed: () => FlutterACPCore.trackState("myState",
                  data: {"key1": "value1"}),
            ),
            RaisedButton(
              child: Text("ACPCore.trackAction(...)"),
              onPressed: () => FlutterACPCore.trackAction("myAction",
                  data: {"key1": "value1"}),
            ),
            TextField(
              decoration: InputDecoration(
                  border: new OutlineInputBorder(
                      borderSide: new BorderSide(color: Colors.teal)),
                  hintText: 'Enter a griffon url'),
              onChanged: (text) {
                _url_text = text;
              },
            ),
            RaisedButton(
              child: Text("ACPGriffon.startSession(...)"),
              onPressed: () => FlutterGriffon.startSession(_url_text),
            ),
            RaisedButton(
              child: Text("ACPGriffon.endSession(...)"),
              onPressed: () => FlutterGriffon.endSession(),
            ),
            RaisedButton(
              child: Text("ACPGriffon.sendEvent(...)"),
              onPressed: () => FlutterGriffon.sendEvent("com.adobe.griffon",
                  "Shared State Contents", {'state.data': "state"}),
            ),
            RaisedButton(
              child: Text("ACPGriffon.attemptReconnect()"),
              onPressed: () => FlutterGriffon.attemptReconnect(),
            ),
            RaisedButton(
              child: Text("ACPGriffon.logLocalUI()"),
              onPressed: () => FlutterGriffon.logLocalUILevel(
                  ACPGriffonUILogColor.VISIBILITY_HIGH, "Log UI test message"),
            ),
          ]),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_griffon: ^1.0.0-beta.3

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

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

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
flutter_acpcore >=1.0.0-beta.1 <2.0.0 1.0.0
Transitive dependencies
collection 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