TypeMate class

The main TypeMate plugin class that provides system-wide text input tracking and overlay functionality.

This plugin enables tracking user text input across all applications and displays a popup overlay bubble when typing is detected.

Overview

TypeMate works by combining two Android services:

  • Accessibility Service: Detects text field focus events system-wide
  • Overlay Service: Displays floating bubbles over other applications

Usage Example

// Initialize the plugin
final typeMate = TypeMate.instance;
await typeMate.initialize();

// Set up event listeners
typeMate.textFieldFocusedStream.listen((_) {
  print('User started typing!');
});

// Check and request permissions
if (!await typeMate.hasAllPermissions()) {
  await typeMate.requestOverlayPermission();
  await typeMate.openAccessibilitySettings();
}

// Start the overlay service
await typeMate.startOverlayService();

Permissions Required

  • SYSTEM_ALERT_WINDOW: For displaying overlay bubbles
  • BIND_ACCESSIBILITY_SERVICE: For detecting text input events
  • FOREGROUND_SERVICE: For running the overlay service

Platform Support

Currently only supports Android API 21+. iOS is not supported due to platform limitations that prevent system-wide overlays.

See also:

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textFieldFocusedStream Stream<void>
Stream of text field focused events.
no setter
textFieldUnfocusedStream Stream<void>
Stream of text field unfocused events.
no setter

Methods

checkAccessibilityService() Future<bool>
Check if accessibility service is enabled
checkOverlayPermission() Future<bool>
Check if overlay permission is granted
dispose() → void
Dispose the plugin and clean up resources
getStatus() Future<Map<String, dynamic>>
Get status of all components
hasAllPermissions() Future<bool>
Check if all required permissions are granted
initialize() Future<bool>
Initializes the TypeMate plugin.
isOverlayVisible() Future<bool>
Check if the overlay is currently visible
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openAccessibilitySettings() Future<void>
Open accessibility settings
quickSetup() Future<Map<String, bool>>
Quick setup method for common use cases
requestOverlayPermission() Future<void>
Request system overlay permission
startOverlayService() Future<void>
Start the overlay service
stopOverlayService() Future<void>
Stop the overlay service
testOverlay() Future<void>
Test the overlay functionality
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance TypeMate
Gets the singleton instance of TypeMate.
no setter