TypeMate: Building a System-Wide Writing Assistant for Flutter on Android


Sometimes the simplest ideas solve the biggest headaches.
I wanted a way to trigger a writing assistant overlay whenever a user taps on a text field in any app. Simple to describe. Surprisingly tricky to build β especially in Flutter.
This blog is about how that problem led to TypeMate, a Flutter plugin that lets you create system-wide overlays on Android.
π‘ The Problem
Most writing tools live inside one app β think Grammarly, Google Docs, Notion.
But what if you want:
Grammar check in your messaging app
AI suggestions in your email app
Quick text snippets for any form
On Android, itβs technically possible with Accessibility Service + Overlay, but Flutter didnβt have a clean solution.
π The Approach
The concept:
User taps a text field in any app
β
Accessibility Service detects focus
β
Overlay bubble appears on top
β
User interacts with writing assistant tools
π¦ What TypeMate Does
TypeMate combines three components:
1. Flutter Plugin Interface
The Dart API that developers call:
await TypeMate.instance.initialize();
await TypeMate.instance.startOverlayService();
2. Android Accessibility Service
Detects when a TYPE_VIEW_FOCUSED
event happens in any app.
3. Overlay Service
Shows a draggable, customizable bubble using SYSTEM_ALERT_WINDOW
.
βοΈ Key Features
System-wide overlay detection
Customizable bubble UI
Runs in the background as a Foreground Service
Permission handling (Overlay + Accessibility)
π The Technical Challenges
- Permission Flow
Android requires manual enabling of both the Overlay & Accessibility Service.
TypeMate provides methods to open these settings easily.
2. Battery Optimisation
- Foreground Service is needed to avoid the system killing it.
3. Cross-App Event Handling
- Accessibility events are noisy β filtering only text field focus events was key.
π Use Cases
AI Writing Assistant
Connect to GPT or other NLP tools to improve writing in real-time.
Grammar & Spell Check
Like Grammarly, but integrated into any text field.
Quick Insert Tools
Add snippets, templates, or frequently used phrases anywhere.
Custom Productivity Tools
Translate text, expand shorthand, etc.
π Example Usage
TypeMate.instance.textFieldFocusedStream.listen((_) {
print("Text field focused in an external app");
// Show your custom tools
});
π¦ Limitations
Android only (iOS blocks system-wide overlays)
Manual permission steps required
API Level 21+ needed for overlay features
π¬ Closing Thoughts
TypeMate is just starting.
Planned features:
Custom bubble UI builder in Flutter
Better performance & event filtering
Integration-ready hooks for AI/NLP tools
Iβd love the community to try it, break it, and improve it.
π¦ Pub.dev: TypeMate
π» GitHub: Repository
Subscribe to my newsletter
Read articles from Ratul Hasan Ruhan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ratul Hasan Ruhan
Ratul Hasan Ruhan
Hey, I'm Ratul Hasan Ruhanβa Flutter enthusiast, mobile app developer, and tech blogger. Let's explore the world of Flutter together! π #MobileDev