1

I'm trying to make an application. I want to add events to local calendar. But I don't know how to do that. It would be better if there were some simple examples.

Andy
  • 35
  • 2
  • 5

1 Answers1

2

You can use the plugin add_2_calendar.

Installation :

In your pubspec.yaml file within your Flutter Project:

dependencies:
  add_2_calendar: ^1.3.0

iOS integration :

In order to make this plugin work on iOS 10+, be sure to add this to your info.plist file:

<key>NSCalendarsUsageDescription</key>
<string>INSERT_REASON_HERE</string>

Usage :

import 'package:add_2_calendar/add_2_calendar.dart';

final Event event = Event(
      title: 'Event title',
      description: 'Event description',
      location: 'Event location',
      startDate: DateTime(/* Some date here */),
      endDate: DateTime(/* Some date here */),
    );
...
Add2Calendar.addEvent2Cal(event);
...

See also Flutter documentation for using packages. You can look for packages on pub.dev when you need to use device APIs.

Augustin R
  • 7,089
  • 3
  • 26
  • 54