awareframework_core 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

awareframework_core #

Build Status

A Core Plugin for Aware Framework on Flutter

Developing Aware Plugin for Flutter #

Flutter #

  1. Make a template app using flutter command
$ flutter create --org com.awareframework.accelerometer --template=plugin -i swift -a kotlin awareframework_accelerometer
  1. Add the awareframework_core into your pubspec.yaml

You can get more information about the package installation via the following link.

  1. Implement your sensor using the core-library
/// The Accelerometer Sensor class
class AccelerometerSensor extends AwareSensor {

  /// Accelerometer Method Channel
  static const MethodChannel _accelerometerMethod = const MethodChannel('awareframework_accelerometer/method');

  /// Accelerometer Event Channel
  static const EventChannel  _accelerometerStream  = const EventChannel('awareframework_accelerometer/event');

  /// Init Accelerometer Sensor with AccelerometerSensorConfig
  AccelerometerSensor.init(AccelerometerSensorConfig config) : super.init(config){

  Stream<Map<String,dynamic>> get onDataChanged {
     return super.getBroadcastStream( _accelerometerStream, "on_data_changed").map((dynamic event) => Map<String,dynamic>.from(event));

  void cancelAllEventChannels() {


/// The Sensor Configuration Parameter class
class AccelerometerSensorConfig extends AwareSensorConfig {

  int frequency    = 5;
  double period    = 1.0;
  double threshold = 0.0;


  Map<String, dynamic> toMap() {
    var map = super.toMap();
    map['frequency'] = frequency;
    map['period']    = period;
    map['threshold'] = threshold;
    return map;

Android #

iOS #

  1. Add following code into ios/awareframework_accelerometer.podspec
  # update author information and url
  s.dependency 'awareframework_core'
  s.ios.deployment_target = '10.0'
  # add other dependency
  1. Run pod install at example/ios

  2. Open iOS project (example/ios/Runner.xcworkspace) and change a deplyment target to 10.0

import Flutter
import UIKit
import com_awareframework_ios_sensor_accelerometer
import com_awareframework_ios_sensor_core
import awareframework_core

public class SwiftAwareframeworkAccelerometerPlugin: AwareFlutterPluginCore, FlutterPlugin, AwareFlutterPluginSensorInitializationHandler, AccelerometerObserver{
    var accelerometerSensor:AccelerometerSensor?
    public override init() {
        super.initializationCallEventHandler = self
    public func initializeSensor(_ call: FlutterMethodCall, result: @escaping FlutterResult) -> AwareSensor? {
        if self.sensor == nil {
            if let config = call.arguments as? Dictionary<String,Any>{
                self.accelerometerSensor = AccelerometerSensor.init(AccelerometerSensor.Config(config))
                self.accelerometerSensor = AccelerometerSensor.init(AccelerometerSensor.Config())
            self.accelerometerSensor?.CONFIG.sensorObserver = self
            return self.accelerometerSensor
            return nil
    public static func register(with registrar: FlutterPluginRegistrar) {
        let instance = SwiftAwareframeworkAccelerometerPlugin()
        // add own channel
        super.setMethodChannel(with: registrar,
                               instance: instance,
                               channelName: "awareframework_accelerometer/method");
        super.setEventChannels(with: registrar,
                               instance: instance,
                               channelNames: ["awareframework_accelerometer/event"]);

    public func onDataChanged(data: AccelerometerData) {
        for handler in self.streamHandlers {
            if handler.eventName == "on_data_changed" {

Eaxample App #

import 'package:awareframework_core/awareframework_core.dart';

class _MyAppState extends State<MyApp> {
  AccelerometerSensor sensor;
  AccelerometerSensorConfig config;
  void initState() {
    config = AccelerometerSensorConfig()
      ..debug = true
      ..label = "label";
    sensor = new SampleSensor(config);


  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
          appBar: new AppBar(
            title: const Text('Plugin Example App'),
          body: new AccelerometerCard(sensor: sensor)

Publishing the your plugin #

Add author and homepage information into pubspec.yaml #

author: AWARE Mobile Context Instrumentation Middleware/Framework <>

Publish #

$ flutter packages pub publish --dry-run
$ flutter packages pub publish

0.0.1 #

  • TODO: Describe initial release.


awareframework_core_example #

Demonstrates how to use the awareframework_core plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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

  awareframework_core: ^0.1.1

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:awareframework_core/awareframework_core.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 Jan 25, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Format lib/awareframework_core.dart.

Run flutter format to format lib/awareframework_core.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (charts_flutter).

Package is getting outdated. (-11.23 points)

The package was last published 58 weeks ago.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
charts_flutter ^0.5.0 0.5.0 0.8.1
flutter 0.0.0
Transitive dependencies
charts_common 0.5.0 0.8.1
collection 1.14.11 1.14.12
intl 0.15.8 0.16.1
logging 0.11.4
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
test any