Android bindings plugin for Flutter.

Overview

Flutter Android Bindings

Project license Dart compatibility Pub package Dartdoc reference

This is a Flutter plugin for using Android's numerous platform-specific APIs in Flutter apps.

Screenshot

Screenshot of Android settings

Prerequisites

Compatibility

Android only.

Installation

dependencies:
  flutter_android: ^0.8.0

Features

  • Implements bindings to a growing set of Android's platform-specific APIs.

  • Reduces duplication of effort by centralizing Android bindings in a single package.

Feature Table

Feature Flutter API
Activity launch android_content.Intent#startActivity()
Bluetooth scanning android_bluetooth.BluetoothLeScanner
Distance calculation android_location.Location.distanceBetween()
Face detection android_media.FaceDetector
Heart-rate monitoring android_hardware.SensorManager.getDefaultSensor()
Parcel serialization android_os.Parcel
Sensor event streams android_hardware.Sensor#subscribe()

TODO: dirs

Examples

Activity launch

import 'package:flutter_android/android_content.dart' show Intent;

await Intent(
  action: "android.intent.action.VIEW", // Intent.ACTION_VIEW
  data: Uri.parse("https://flutter.dev"),
).startActivity();

Parcel serialization

import 'package:flutter_android/android_os.dart' show Parcel;

var parcel = Parcel.obtain()
  ..writeBoolean(true)
  ..writeInt(42)
  ..writeDouble(3.1415)
  ..writeString("Hello, world!")
  ..writeList(<Object>[1, 2, 3])
  ..writeMap(<String, Object>{"a": 1, "b": 2, "c": 3});

await _channel.invokeMethod('someJavaMethod', parcel.asUint8List());

// In Java, your MethodCallHandler's call.arguments contains the marshaled Parcel

Face detection

import 'package:flutter_android/android_graphics.dart' show Bitmap;
import 'package:flutter_android/android_media.dart' show Face, FaceDetector;

var photo = Image.asset("images/einstein.png");

var bitmap = Bitmap.fromAssetImage(photo.image as AssetImage);
var detector = FaceDetector(width: 280, height: 396);

for (var face in await detector.findFaces(bitmap)) {
  if (face.confidence < Face.CONFIDENCE_THRESHOLD) {
    continue; // skip dubious results below the cut-off threshold
  }
  print("Found a face at (${face.midPoint.x}, ${face.midPoint.y}) with confidence ${face.confidence}");
}

Heart-rate monitoring

import 'package:flutter_android/android_hardware.dart'
    show Sensor, SensorEvent, SensorManager;

var sensor = await SensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);

var events = await sensor.subscribe();
events.listen((SensorEvent event) {
  print(event.values[0]);
});

Frequently Asked Questions

TODO

Caveats

  • iOS is not and cannot be supported. All flutter_android APIs throw an AssertionError if they are invoked when running on iOS. For cross-platform apps, we recommend that you depend on the platform package to conditionalize your use of Android APIs.

Reference

android

import 'package:flutter_android/android.dart' as android;

android_app

import 'package:flutter_android/android_app.dart' as android_app;

android_bluetooth

import 'package:flutter_android/android_bluetooth.dart' as android_bluetooth;

android_content

import 'package:flutter_android/android_content.dart' as android_content;

android_database

import 'package:flutter_android/android_database.dart' as android_database;

android_graphics

import 'package:flutter_android/android_graphics.dart' as android_graphics;

android_hardware

import 'package:flutter_android/android_hardware.dart' as android_hardware;

android_location

import 'package:flutter_android/android_location.dart' as android_location;

android_media

import 'package:flutter_android/android_media.dart' as android_media;

android_os

import 'package:flutter_android/android_os.dart' as android_os;

Cross-Reference

Android Flutter
android.app android_app
android.app.Activity android_app.Activity
android.app.ActivityManager android_app.ActivityManager
android.app.AlarmManager android_app.AlarmManager
android.app.AuthenticationRequiredException android_app.AuthenticationRequiredException
android.app.DownloadManager android_app.DownloadManager
android.app.KeyguardManager android_app.KeyguardManager
android.app.Notification android_app.Notification
android.app.Notification.Action android_app.NotificationAction
android.app.Notification.Builder android_app.NotificationBuilder
android.app.NotificationManager android_app.NotificationManager
android.app.PendingIntent android_app.PendingIntent
android.app.SearchManager android_app.SearchManager
android.app.WallpaperColors android_app.WallpaperColors
android.app.WallpaperInfo android_app.WallpaperInfo
android.app.WallpaperManager android_app.WallpaperManager
android.bluetooth android_bluetooth
android.bluetooth.BluetoothAdapter android_bluetooth.BluetoothAdapter
android.bluetooth.BluetoothDevice android_bluetooth.BluetoothDevice
android.bluetooth.BluetoothHeadset android_bluetooth.BluetoothHeadset
android.bluetooth.BluetoothManager android_bluetooth.BluetoothManager
android.bluetooth.le.BluetoothLeScanner android_bluetooth.BluetoothLeScanner
android.bluetooth.le android_bluetooth
android.content android_content
android.content.ActivityNotFoundException android_content.ActivityNotFoundException
android.content.ComponentName android_content.ComponentName
android.content.ContentValues android_content.ContentValues
android.content.Context android_content.Context
android.content.Intent android_content.Intent
android.content.IntentFilter android_content.IntentFilter
android.content.SharedPreferences android_content.SharedPreferences
android.database android_database
android.database.Cursor android_database.Cursor
android.database.CursorIndexOutOfBoundsException android_database.CursorIndexOutOfBoundsException
android.database.DatabaseUtils android_database.DatabaseUtils
android.database.MatrixCursor android_database.MatrixCursor
android.database.SQLException android_database.SQLException
android.graphics android_graphics
android.graphics.Bitmap android_graphics.Bitmap
android.graphics.Color dart-ui.Color
android.graphics.Point android_graphics.Point
android.graphics.PointF android_graphics.PointF
android.graphics.drawable.Icon flutter.Icon
android.hardware android_hardware
android.hardware.Sensor android_hardware.Sensor
android.hardware.SensorEvent android_hardware.SensorEvent
android.hardware.SensorEventListener android_hardware.SensorEventListener
android.hardware.SensorManager android_hardware.SensorManager
android.location android_location
android.location.Location android_location.Location
android.media android_media
android.media.FaceDetector android_media.FaceDetector
android.media.FaceDetector.Face android_media.Face
android.net android_net
android.nfc android_nfc
android.os android_os
android.os.BatteryManager android_os.BatteryManager
android.os.Build android_os.Build
android.os.Bundle android_os.Bundle
android.os.Environment android_os.Environment
android.os.HardwarePropertiesManager android_os.HardwarePropertiesManager
android.os.Parcel android_os.Parcel
android.os.Parcelable android_os.Parcelable
android.os.PowerManager android_os.PowerManager
android.os.Process android_os.Process
android.os.StatFs android_os.StatFs
android.os.SystemClock android_os.SystemClock
android.os.UserManager android_os.UserManager
android.os.VibrationEffect android_os.VibrationEffect
android.os.Vibrator android_os.Vibrator
android.provider android_provider
android.security android_security
android.speech android_speech
android.telephony android_telephony
android.view android_view
java.util.Locale dart-ui.Locale

See Also

  • The win32 package provides bindings to the most common Win32 APIs.
Comments
Owner
D.R.Y. Dart
Public domain libraries for the Dart programming language.
D.R.Y. Dart
Dart bindings for Raylib!

Raylib-Dart Dart bindings for raylib 3.7.0, a simple and easy-to-use library to learn videogames programming www.raylib.com Note This project is still

Ryuzaki 6 Jan 18, 2022
Aris wasmjsextend - Binding generator for FFI bindings

Binding generator for FFI bindings. Note: ffigen only supports parsing C headers

Behruz Hurramov 1 Jan 9, 2022
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

Flutter permission_handler plugin The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation o

Baseflow 1.7k Dec 31, 2022
Klutter plugin makes it possible to write a Flutter plugin for both Android and iOS using Kotlin only.

The Klutter Framework makes it possible to write a Flutter plugin for both Android and iOS using Kotlin Multiplatform. Instead of writing platform spe

Gillian 33 Dec 18, 2022
Flutter plugin (android) for sharing bytes and files Offline, (Based on the android Nearby Connections API)

nearby_connections An android flutter plugin for the Nearby Connections API Currently supports Bytes and Files. Transfer Data between multiple connect

Prerak Mann 63 Nov 21, 2022
This is just the simplyfied Flutter Plugin use for one of the popular flutter plugin for social media login.

social_media_logins Flutter Plugin to login via Social Media Accounts. Available Social Media Logins: Facebook Google Apple Getting Started To use thi

Reymark Esponilla 3 Aug 24, 2022
Unloc customizations of the Permission plugin for Flutter. This plugin provides an API to request and check permissions.

Flutter Permission handler Plugin A permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check perm

Unloc 1 Nov 26, 2020
A Flutter step_tracker plugin is collect information from user and display progress through a sequence of steps. this plugin also have privilege for fully customization from user side. like flipkart, amazon, myntra, meesho.

step_tracker plugin A Flutter step_tracker plugin is collect information from user and display progress through a sequence of steps. this plugin also

Roshan nahak 5 Oct 21, 2022
Flutter simple image crop - A simple and easy to use flutter plugin to crop image on iOS and Android

Image Zoom and Cropping plugin for Flutter A simple and easy used flutter plugin to crop image on iOS and Android. Installation Add simple_image_crop

null 97 Dec 14, 2021
Flutter blue plus - Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android and iOS

Introduction FlutterBluePlus is a bluetooth plugin for Flutter, a new app SDK to

null 141 Dec 22, 2022
Flutter plugin for selecting images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotation, cropping, adding sticker/text/filters.

advance_image_picker Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edi

Weta Vietnam 91 Dec 19, 2022
A Flutter plugin integrated with Android-SerialPort-API

A Flutter plugin integrated with Android-SerialPort-API.

null 1 Nov 10, 2021
Flutter Local Notifications - Learn how to implement local notifications into both Android and iOS using flutter_local_notifications plugin.

Flutter Local Notifications Example Flutter Local Notifications - Learn how to implement local notifications into both Android and iOS using flutter_l

Sandip Pramanik 12 Nov 29, 2022
A Flutter plugin that provides assets abstraction management APIs without UI integration, you can get assets (image/video/audio) on Android, iOS and macOS.

photo_manager Photo/Assets management APIs for Flutter without UI integration, you can get assets (image/video/audio) from Android, iOS and macOS. 提供相

FlutterCandies 526 Jan 4, 2023
A Flutter Plugin for Volume Control and Monitoring, support iOS and Android

flutter_volume A flutter plugin for volume control and monitoring, support iOS and Android 手把手带你写 Flutter 系统音量插件 https://www.yuque.com/befovy/share/fl

befovy 35 Dec 9, 2022
A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper on Android devices.

wallpaper_manager A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper(s) on Android devices. Usage Installation In the pubs

Aditya Mulgundkar 38 Nov 28, 2022
A flutter plugin to crop image on iOS and Android.

Image Cropping plugin for Flutter A flutter plugin to crop image on iOS and Android. The plugin comes with a Crop widget. The widget renders only imag

Volodymyr Lykhonis 292 Dec 27, 2022
A Flutter plugin for IOS and Android providing a simple way to display PDFs.

Pdf Viewer Plugin A Flutter plugin for IOS and Android providing a simple way to display PDFs. Features: Display PDF. Installation First, add pdf_view

Lucas Britto 56 Sep 26, 2022