패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.8.0

flutter_android

Android 플랫폼 전용 API를 위한 Flutter 플러그인으로, Android 바인딩을 하나의 패키지에 중앙 집중화하여 중복 작업을 줄입니다.

30일 다운로드
212
좋아요
40
Pub 점수
30

패키지 설치

flutter pub add flutter_android

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

안드로이드 고유의 플랫폼 API에 액세스할 수 있도록 해주는 플러터 플러그인으로, 개발자가 플러터 앱 내에서 네이티브 안드로이드 기능을 활용할 수 있게 합니다. 하나의 패키지에 안드로이드 바인딩을 중앙 집중화함으로써 코드 중복을 줄이고 프로젝트 간 개발을 간소화합니다. 플러터의 플랫폼 채널 시스템과 원활하게 통합되도록 설계되어, Dart와 네이티브 안드로이드 코드 간의 효율적인 통신을 가능하게 합니다. 안드로이드 고유의 장치 수준 기능 및 시스템 상호작용을 지원합니다.

사용 사례

  • Android 전용 시스템 기능에 액세스하기
  • 네이티브 안드로이드 라이브러리 통합
  • Flutter 프로젝트 간 코드 중복 줄이기
  • 플랫폼 최적화된 Android 경험 구축
  • Flutter에서 고급 장치 제어 활성화

주요 기능

  • 중앙 집중형 Android API 바인딩
  • 네이티브 통합을 위한 최소한의 보일러플레이트
  • Flutter의 플랫폼 채널을 지원합니다
  • 유지보수를 고려하여 설계됨
  • 오픈소스이며 커뮤니티 주도

적합한 대상

  • Android 중심의 Flutter 개발자
  • 여러 개의 Flutter 앱을 유지 관리하는 팀
  • 심층적인 Android 통합이 필요한 프로젝트
  • 중복된 플랫폼 코드를 피하는 개발자

고려 사항

  • Android 플랫폼에 한정
  • Android 네이티브 개발에 대한 지식이 필요합니다
  • 크로스 플랫폼 전용 사용 사례에 적합하지 않습니다
  • 플랫폼 채널의 올바른 설정에 의존
  • 새로운 Android SDK 버전을 위해 업데이트가 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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.

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트