Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

notepad-core

woodemi12ISC0.3.0

English | 简体中文

readme

English | 简体中文

notepad_core

Flutter plugin for connect & operate on smart notepad

Usage

  • Scan notepad
  • Connect notepad
  • Sync notepen pointer

Scan notepad

Web

let device = notepadConnector.requestDevice();
console.log(`requestDevice ${device}`);

Mini-program on Wechat

let scanResultReceiver = function (scanResult) {
  console.log(`onScanResult ${scanResult}`);
};
notepadConnector.onScanResult(scanResultReceiver);

notepadConnector.startScan();
// ...
notepadConnector.stopScan();

notepadConnector.offScanResult(scanResultReceiver);

Connect notepad

Connect to device requested from notepadConnector.requestDevice()

or scanResult received from notepadConnector.onScanResult

let connectionChangeHandler = function (notepadClient, connectionState) {
  console.log(`onConnectionChange ${notepadClient}, ${connectionState}`);
};
notepadConnector.onConnectionChange(connectionChangeHandler);

notepadConnector.connect(obj); // obj = device/scanResult
// ...
notepadConnector.disconnect();

notepadConnector.offConnectionChange(connectionChangeHandler);

Sync notepen pointer

NotepadClient#setMode

  • NotepadMode.Common

    Notepad saves only NotePenPointer with positive pressure & accurate timestamp, into offline memo

  • NotepadMode.Sync

    Notepad notify every NotePenPointer, positive or not, without timestamp, to connected mobile device

Notepad is always NotepadMode.Common (connected or disconnected), unless setMode after connected

await _notepadClient.setMode(NotepadMode.Sync);
console.log("setMode complete");

NotepadClient#onSyncPointerReceive

Receive NotePenPointers in NotepadMode.Sync

let syncPointerReceiver = function (pointers) {
  console.log(`onSyncPointerReceive ${pointers.length}`);
};

_notepadClient.onSyncPointerReceive(syncPointerReceiver);
// ...
_notepadClient.offSyncPointerReceive(syncPointerReceiver);

changelog

[0.3.0] - 2020-5-31

  • Support mini-program on Wechat
  • Add startScan, stopScan & on/offScanResult to NotepadConnector only for mini-program on Wechat
  • [BREAKING CHANGE] Refactor connectionChangeHandler to on/offConnectionChange
  • [BREAKING CHANGE] Refator syncPointerHandler to on/offScanResult

[0.2.0] - 2020-1-3

NotepadConnector

  • Add argument NotepadClient to connectionChangeHandler

NotepadClient

Sync input

  • setMode
  • syncPointerHandler

[0.1.0] - 2020-1-1

NotepadConnector

Request device

  • requestDevice for Web

Connect/Disconnect device

  • connect, disconnect