Giter Site home page Giter Site logo

testeurmaniak / icalendar_parser Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 3.0 441 KB

Flutter package to parse iCalendar (.ics) files.

Home Page: https://pub.dev/packages/icalendar_parser

License: MIT License

Dart 100.00%
dart flutter ical-parser icalendar ics ics-files parser

icalendar_parser's Introduction

icalendar_parser's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar jjchiw avatar levi-lesches avatar lucacoduriv avatar simonbengtsson avatar stevenboeckmans avatar testeurmaniak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

icalendar_parser's Issues

Add built-in support for `CREATED` property

If I understand correctly, according to the spec here, the CREATED property is built-in (to the spec?). Or it's just not a common (and optional) property, enough to include in this package.

Any chance this can be built in to icalendar_parser? If so, I could take a stab at a PR maybe. Are there any related tests stuff that I would need to implement, if so what?

Thanks!

Full link to spec: https://icalendar.org/iCalendar-RFC-5545/3-8-7-1-date-time-created.html

how to use in flutterflow?

I'm a beginner. could someone explain or suggest a tutorial on how to implement this in flutterflow? thanks

Exception on `ORGANIZER` field parsing

There is an issue with parsing ICS containing partial ORGANIZER field (with no email specified):

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:ac6d76d2-deb8-421d-86c6-670c06d5cd8c
SUMMARY:Cool event
DTSTAMP:20211004T074300Z
DTSTART:20211006T063000Z
DTEND:20211006T073000Z
DESCRIPTION:Some description
ORGANIZER;CN=Joe Jackson
END:VEVENT
END:VCALENDAR

Produces following exception:

type 'String' is not a subtype of type 'List<String>' of 'other'

at

#1      ICalendar.fromListToJson (package:icalendar_parser/src/model/icalendar.dart:253:35)

Issue with Multiline Descriptions

BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//Moodle Pty Ltd//NONSGML Moodle Version 2020061501//EN
VERSION:2.0
BEGIN:VEVENT
UID:[email protected]
SUMMARY:200925 - Einfache Schlange (Warteschlange Freizeitpark) ist fällig.
DESCRIPTION:Bearbeitet im Net-Schulbuch auf der Seite "baab_aufgaben" die A
	ufgabe 3.\n\nLadet eure Lösungen als zip-Datei hier hoch.\n\n
	
CLASS:PUBLIC
LAST-MODIFIED:20201009T103237Z
DTSTAMP:20201023T110413Z
DTSTART:20201005T080000Z
DTEND:20201005T080000Z
CATEGORIES:Q1_GK IF 1_Kock
END:VEVENT
BEGIN:VEVENT
UID:[email protected]
SUMMARY:Testaufgabe ist fällig.
DESCRIPTION:Agrobusiness - Lösung des Welternährungsproblems\n\n
CLASS:PUBLIC
LAST-MODIFIED:20201006T201443Z
DTSTAMP:20201023T110413Z
DTSTART:20201005T220000Z
DTEND:20201005T220000Z
CATEGORIES:Q1_LK_EK1_Muel
END:VEVENT
BEGIN:VEVENT
UID:[email protected]
SUMMARY:Verschiedene Übungen als Vorbereitung auf die anstehende Klausur zu
	m Thema "sprachliche Varietäten" ist fällig.
	
DESCRIPTION:1. Stelle alle Positionen zum Thema "Kiezdeutsch" in einer ausf
	ührlichen Tabelle zusammen zusammen.\n\n2. Schreibt Definitionen für die Sp
	rachvarietäten "Dialekt" und "Soziolekt.\n\n3. Stellt tabellarisch die Vor-
	 und Nachteile des Sprechens von Dialekten dar.\n\n4. Schreibt die Merkmale
	 von Dialekt\, Kiezdeutsch sowie Jugendsprache auf. Beachtet dabei auch Gra
	mmatik\, Semantik und Phonetik.\n\n
	
CLASS:PUBLIC
LAST-MODIFIED:20201023T084557Z
DTSTAMP:20201023T110413Z
DTSTART:20201006T220000Z
DTEND:20201006T220000Z
CATEGORIES:Q1_GK D_Hölv
END:VEVENT
BEGIN:VEVENT
UID:[email protected]
SUMMARY:Tasks to the topic of GB ist fällig.
DESCRIPTION:1. Send me your lectures (Referate bitte einstellen).\n\n2. Cho
	ose one character from the movie we are going to watch soon. give reasons w
	hy you have decided to write about this character\, why or why not you like
	 it. Write about his/ her situation and the way he oder she is dealing with
	 the arising conflicts. You should additionally comment on the character an
	d maybe suggest ways that could support the character. Feel free to utter y
	our feelings\, questions or to add criticism on some kind of behaviour\, fo
	r example.\n\n
	
CLASS:PUBLIC
LAST-MODIFIED:20201023T092950Z
DTSTAMP:20201023T110413Z
DTSTART:20201006T220000Z
DTEND:20201006T220000Z
CATEGORIES:Q1_GK E2_Hölv
END:VEVENT
BEGIN:VEVENT
UID:[email protected]
SUMMARY:Testaufgabe ist fällig.
DESCRIPTION:Hallo zusammen\,\n\nhier kommt eine Testaufgabe für euch! Bitte
	 fotografiert eine Steckdose und sendet mir das Foto über Logineo zu.\n\nHe
	rzliche Grüße\n\nvon Frau Haase\n\n
	
CLASS:PUBLIC
LAST-MODIFIED:20200930T181945Z
DTSTAMP:20201023T110413Z
DTSTART:20201007T140000Z
DTEND:20201007T140000Z
CATEGORIES:Q1_GK_Physik_Haase
END:VEVENT
BEGIN:VEVENT
UID:[email protected]
SUMMARY:201009 - Generische Queue (Musikwuensche) ist fällig.
DESCRIPTION:Liebe Schülerinnen und Schüler\,\n\nbearbeitet im Net-Schulbuch
	 auf der Seite baab_aufgabe2 die Aufgaben 1 und 2. Für Aufgabe 2 verwendet 
	die Datei im Anhang.\n\nDiese müsst ihr herunterladen und "extrahieren". Sp
	eichert sie beim Extrahieren in einem geeigneten Verzeichnis.\n\nHinweis: A
	uf der Seite baab_queue findet ihr eine Erklärung zur generischen Schlange.
	\n
	
CLASS:PUBLIC
LAST-MODIFIED:20201009T103223Z
DTSTAMP:20201023T110413Z
DTSTART:20201011T210000Z
DTEND:20201011T210000Z
CATEGORIES:Q1_GK IF 1_Kock
END:VEVENT
END:VCALENDAR

This is my full .ics and as you can see the descriptions are multiline strings but after parsing only the first line (the one after DESCRIPTION: ) is stored.

Error while loading in new .ics File!

Many auto generated .ics Files end with an empty line under the END:VCALENDAR, but this package throws an error saying the file doesnt end with an END:VCALENDAR Statement. If i find some time in the near future i will propably open a Pull Request fixing this issue.

Error while parsing I Calendar

Hello, first of all this is probably the wrong place but I'm quite new, so im Sorry. I really need to parse an .ics File for my Project but for some reason it doesn't work, also your package is the only one which seems to be capable of doing that.

My understanding is that the Method getEvents() should return a List of CalendarItem's, but it always gives the following error.
Also here is my .ics file (I needed to rename it .txt just change the file extension
icalexport.txt
).

My Code:

import 'package:flutter/services.dart' show rootBundle;
import 'package:icalendar_parser/icalendar_parser.dart';

Future getData() async {
  final icsString = await rootBundle.loadString('assets/icalexport.ics');
  final iCalendar = ICalendar.fromString(icsString);
  print(iCalendar);
  return iCalendar;
}

Future getEvents() async {
  ICalendar iCalendar = await getData();
  List<CalendarItem> items;

  for (var item in iCalendar.data) {
    items.add(CalendarItem.fromJson(item));
  }
  print(items);
  return items;
}

class CalendarItem {
  final String type;
  final String uid;
  final String name;
  final String description;
  final String categories;

  CalendarItem({
    this.type,
    this.uid,
    this.name,
    this.description,
    this.categories,
  });

  factory CalendarItem.fromJson(Map<String, dynamic> json) {
    return CalendarItem(
      type: json['type'] as String ?? 'empty',
      uid: json['uid'] as String ?? 'empty',
      name: json['name'] as String ?? 'empty',
      description: json['description'] as String ?? 'empty',
      categories: json['categorie'] as String ?? 'empty',
    );
  }
}

Error Message:

E/flutter ( 9628): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: NoSuchMethodError: The method 'add' was called on null.
E/flutter ( 9628): Receiver: null
E/flutter ( 9628): Tried calling: add(Instance of 'CalendarItem')

Google Calendar ical `EXDATE not correctly parsed

Google Calendar's implementation of EXDATE does not follow the specification. Instead of comma-separated datetimes, each EXDATE is written to a new line.

Therefore only the last EXDATE is in the parsed object.

Example:

BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20221205T000000
DTEND;TZID=Europe/Berlin:20221205T020000
RRULE:FREQ=DAILY
EXDATE;TZID=Europe/Berlin:20221210T000000
EXDATE;TZID=Europe/Berlin:20221208T000000
DTSTAMP:20221206T203724Z
UID:[email protected]
CREATED:20221206T102926Z
LAST-MODIFIED:20221206T102926Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Just a quick summary
TRANSP:OPAQUE
END:VEVENT

How to always get the values i am looking for?

Hello, first of all i would like to thank you for the awesome package.
I am trying to parse an .ics file that i get from Apple CalDAV Server.

This is what i am doing. The problem is that sometime the value i am searching for will be in data[0], other times it will be in data[2]. This is also noticeable when an user insert an alarm (VALARM) or not.

So, how can i know which index hold the value i'm looking for? As far as i understood icsJson['data'] will retrieve a List, in which the index that contains the value i want can change based on the .ics file structure.

To simplify, how could i know where 'summary' property is stored in order to always access to it correctly, since every .ics file structure can differ? The same question applies for the other properties i am searching for.

              ICalendar icsFromString = ICalendar.fromString(icsContent);

              Map<String, dynamic> icsJson = icsFromString.toJson();

              List data = icsJson['data'];

              DateTime startTime = DateTime.parse(data[0]['dtstart']['dt']);
              DateTime endTime = DateTime.parse(data[0]['dtend']['dt']);
              String? summary = data[0]['summary'];
              String? description = data[0]['description'];
              String? location = data[0]['location'];
              String? url = data[0]['url'];
              String? rrule = data[0]['rrule'];

Date is not correctly parsed

Hi!

DTSTART;TZID=Europe/Berlin:20210607T090000

is being parsed as

DateTime:<2021-10-31 01:00:00.000Z>

As you can see the date and time is incorrectly parsed. :-( I think using "DateTime.parse(text)" is not enough.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.