Flatpickr class

Flatpickr instance.

Annotations
  • @JS('flatpickr')

Constructors

Flatpickr(Element? element, [FlatpickrOptions? options])
factory

Properties

calendarContainer HtmlElement
This is the div.flatpickr-calendar element.
no setter
config FlatpickrOptions
The configuration object (defaults + user-specified options).
no setter
currentMonth int
The zero-indexed month number (0-11) currently displayed on the calendar.
no setter
currentMonthElement HtmlElement
The span holding the current month’s name.
no setter
currentYear int
The year currently displayed on the calendar.
no setter
currentYearElement HtmlElement
The input holding the current year.
no setter
days HtmlElement
The container for all the day elements.
no setter
hashCode int
The hash code for this object.
no setterinherited
input HtmlElement
The text input element associated with flatpickr.
no setter
nextMonthNav HtmlElement
The right arrow element responsible for incrementing the current month.
no setter
prevMonthNav HtmlElement
The left arrow element responsible for decrementing the current month.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedDates List
The array of selected dates (Date objects).
no setter

Methods

changeMonth(int monthNum, [bool isOffset = true]) → void
Changes the current month.
clear() → void
Resets the selected dates (if any) and clears the input.
close() → void
Resets the selected dates (if any) and clears the input.
destroy() → void
Destroys the flatpickr instance, cleans up - removes event listeners, restores inputs, etc.
jumpToDate(dynamic date, [bool triggerChange = false]) → void
Sets the calendar view to the year and month of date, which can be a date string, a DateTime, or nothing.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open() → void
Shows/opens the calendar.
redraw() → void
Redraws the calendar. Shouldn’t be necessary in most cases.
set(String option, dynamic value) → void
Sets a config option optionto value, redrawing the calendar and updating the current view, if necessary.
setDate(dynamic date, [bool triggerChange = false, String? dateStrFormat]) → void
Sets the current selected date(s) todate, which can be a date string, a DateTime, or an array of dates.
toggle() → void
Shows/opens the calendar if its closed, hides/closes it otherwise.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

formatDate(DateTime dateObj, String dateFormat) String
Transforms JS date object to string according to date format.
parseDate(String dateStr, String dateFormat) DateTime
Parses date string according to date format.