device_calendar 패키지는 Android 및 iOS에서 사용자 장치 캘린더와 상호 작용할 수 있는 크로스 플랫폼 플러터 플러그인입니다. 이 패키지는 장치의 네이티브 캘린더 시스템에서 캘린더 이벤트 및 캘린더를 직접 읽고, 만들고, 업데이트하고 삭제할 수 있습니다. 원활한 통합을 위해 플랫폼 간 일관된 API를 제공하면서도 플랫폼별 특성과 권한을 존중합니다. 따라서 생산성, 스케줄링, 알림 애플리케이션과 같은 직접 캘린더 접근이 필요한 앱에 이상적입니다.
사용 사례
예약 일정 조정
이벤트 알림 만들기
기기 캘린더와 동기화
캘린더 이벤트 관리
작업 관리 앱 구축
주요 기능
크로스 플랫폼 호환성
네이티브 캘린더 통합
이벤트 생성 및 삭제
캘린더 권한 처리
플랫폼별 동작 지원
적합한 대상
생산성 앱
캘린더 기반 알림
작업 관리 도구
이벤트 기획 소프트웨어
캘린더 동기화가 필요한 앱
고려 사항
모든 플랫폼에서 사용자 권한이 필요합니다
기본 캘린더 시스템에 한정
안드로이드와 iOS 간에 동작이 다를 수 있습니다
웹 또는 데스크톱 지원 없음
기기 캘린더 사용 가능 여부에 따라 달라집니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Device Calendar Plugin
A cross platform plugin for modifying calendars on the user's device.
Breaking changes at v4
If you're upgrading from previous versions, your code will need to be modified (slightly), otherwise it will not run after update. See Timezone support for more details.
There are some changes to event JSON formats at v4. Pay extra care if you handle event JSONs. Directly calling to and from device calendars should be unaffected.
Features
Request permissions to modify calendars on the user's device
Check if permissions to modify the calendars on the user's device have been granted
Add or retrieve calendars on the user's device
Retrieve events associated with a calendar
Add, update or delete events from a calendar
Set up, edit or delete recurring events
NOTE: Editing a recurring event will currently edit all instances of it
NOTE: Deleting multiple instances in Android takes time to update, you'll see the changes after a few seconds
Add, modify or remove attendees and receive if an attendee is an organiser for an event
Setup reminders for an event
Specify a time zone for event start and end date
NOTE: Due to a limitation of iOS API, single time zone property is used for iOS (event.startTimeZone)
NOTE: For the time zone list, please refer to the TZ database name column on Wikipedia
Timezone support with TZDateTime
Due to feedback we received, starting from 4.0.0 we will be using the timezone package to better handle all timezone data.
This is already included in this package. However, you need to add this line whenever the package is needed.
import'package:timezone/timezone.dart';
If you don't need any timezone specific features in your app, you may use flutter_native_timezone to get your devices' current timezone, then convert your previous DateTime with it.
import'package:flutter_native_timezone/flutter_native_timezone.dart';
initializeTimeZones();
// As an example, our default timezone is UTC.Location _currentLocation = getLocation('Etc/UTC');
FuturesetCurentLocation() async {
String timezone = 'Etc/UTC';
try {
timezone = awaitFlutterNativeTimezone.getLocalTimezone();
} catch (e) {
print('Could not get the local timezone');
}
_currentLocation = getLocation(timezone);
setLocalLocation(_currentLocation);
}
...
event.start = TZDateTime.from(oldDateTime, _currentLocation);
For other use cases, feedback or future developments on the feature, feel free to open a discussion on GitHub.
Null-safety migration
From v3.9.0, device_calendar is null-safe. However, not all workflows have been checked and bugs from older versions still persist.
You are strongly advised to test your workflow with the new package before shipping.
Better yet, please leave a note for what works and what doesn't, or contribute some bug fixes!
Android Integration
The following will need to be added to the AndroidManifest.xml file for your application to indicate permissions to modify calendars are needed
NOTE: From v4.3.2 developers no longer need to add proguard rule in their app.
By default, all android apps go through R8 for file shrinking when building a release version. Currently, it interferes with some functions such as retrieveCalendars().
You may add the following setting to the ProGuard rules file proguard-rules.pro (thanks to Britannio Jarrett). Read more about the issue here
Since v.1.0, this version has migrated to use AndroidX instead of the deprecated Android support libraries. When using 0.10.0 and onwards for this plugin, please ensure your application has been migrated following the guide here
iOS Integration
For iOS 10+ support, you'll need to modify the Info.plist to add the following key/value pair
<key>NSCalendarsUsageDescription</key><string>Access most functions for calendar viewing and editing.</string><key>NSContactsUsageDescription</key><string>Access contacts for event attendee editing.</string>
For iOS 17+ support, add the following key/value pair as well.
<key>NSCalendarsFullAccessUsageDescription</key><string>Access most functions for calendar viewing and editing.</string>
Note that on iOS, this is a Swift plugin. There is a known issue being tracked here by the Flutter team, where adding a plugin developed in Swift to an Objective-C project causes problems. If you run into such issues, please look at the suggested workarounds there.