icalendar_parser 0.1.0 copy "icalendar_parser: ^0.1.0" to clipboard
icalendar_parser: ^0.1.0 copied to clipboard

outdated

Package to parse iCalendar (.ics) files written in pure Dart.

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Container(
        padding: EdgeInsets.all(16),
        child: FutureBuilder<String>(
          future: rootBundle.loadString('assets/calendar.ics'),
          builder: (_, snapshot) {
            if (!snapshot.hasData)
              return Center(child: CircularProgressIndicator());

            final iCalendar = ICalendar.fromString(snapshot.data);
            return Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text("${iCalendar?.toString()}"),
              ],
            );
          },
        ),
      ),
    );
  }
}
54
likes
0
pub points
89%
popularity

Publisher

verified publisherrouxguillau.me

Package to parse iCalendar (.ics) files written in pure Dart.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on icalendar_parser