You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project demonstrates how to use Flutter MethodChannels to communicate between Flutter (Dart) and native Android (Kotlin).
It includes simple examples for sending messages and retrieving device information like battery level and device model directly from Android.
🚀 Features
Get a message from Android using a platform channel
Fetch device info (battery level & model) via Kotlin
Display data in Flutter UI with responsive updates
Error handling with SnackBars for user feedback
🛠️ Tech Stack
Layer
Technology
Frontend
Flutter (Dart)
Backend / Native
Android (Kotlin)
Channel Type
MethodChannel
📱 How It Works
Flutter calls a MethodChannel with a method name (getMessage or getDeviceInfo).
Android’s MainActivity.kt listens for these calls and executes corresponding native code.
The result (string or map) is sent back to Flutter and displayed in the UI.
🧩 Example Methods
Method
Description
Returns
getMessage
Sends a text message from Android
String
getDeviceInfo
Returns device info & battery level
Map<String, dynamic>
About
A simple Flutter app demonstrating platform channel communication between Flutter and native Android using Kotlin to fetch battery level and device information.