core library
Lark Core
Minimal imports for maximum tree-shaking and smallest bundle size.
Use this instead of package:lark/lark.dart when you want a lean build.
Bundle Size Comparison
| Import | Gzipped Size | Includes |
|---|---|---|
lark.dart |
~33 KB | Everything |
core.dart |
~15 KB | Core only |
+ router.dart |
+5 KB | Routing |
+ store.dart |
+3 KB | State management |
Usage
import 'package:lark/core.dart'; // Core UI & reactivity
import 'package:lark/router.dart'; // Only if using routing
import 'package:lark/store.dart'; // Only if using stores
import 'package:lark/seo.dart'; // Only if using meta tags
import 'package:lark/forms.dart'; // Only if using forms
import 'package:lark/composables.dart'; // Only if using composables
What's Included
- App lifecycle
- Component model (Component, ComponentModels)
- Configuration
- Context / DI
- Platform abstraction
- Primitives (Text, Button, Container, etc.)
- Reactivity (ref, computed, effect, batch)
- Render engine
- Styling
- Theme system
Classes
- Address
- An address element for contact information.
- AppShell
- Internal shell for routing.
- Article
- A semantic article container.
- Aside
- A semantic aside container (sidebars, pull quotes, etc).
- BaseEntry
- The base href tag.
- Blockquote
- A blockquote element.
- Box
- A generic box container (Universal Primitive).
- Breadcrumb
- Navigation breadcrumbs.
- BreadcrumbEllipsis
- Breadcrumb ellipsis (for collapsed items).
- BreadcrumbItem
- A breadcrumb item.
- BreadcrumbList
- Breadcrumb list container.
- BreadcrumbSeparator
- Breadcrumb separator.
- BuildConfig
- Build configuration.
- Button
- A clickable button component.
- ButtonGroup
- A group of related buttons.
- Calendar
- A calendar for date selection.
- Carousel
- A carousel/slider for content.
- CarouselContent
- Carousel content container.
- CarouselItem
- A carousel slide.
- CarouselNext
- Carousel next button.
- CarouselPrevious
- Carousel previous button.
- Column
- A vertical flex container.
- Component
- Abstract base class for all Lark UI components.
-
Computed<
T> - A cached derived value that automatically tracks dependencies.
- Container
- A generic layout container.
- DatePicker
- A date picker with calendar popup.
- Effect
- A reactive side effect that re-runs when dependencies change.
- Empty
- A component that renders nothing.
- Expanded
- Expands child in a flex context.
- Figure
- A figure container with optional caption.
- A semantic footer container.
- Fragment
- Groups children without adding structure.
- GoogleFont
- Configuration for a single Google Font.
- GoogleFontsEngine
- Engine for generating Google Fonts links and scanning CSS.
- Grid
- A grid container.
- H1
- An h1 heading.
- H2
- An h2 heading.
- H3
- An h3 heading.
- H4
- An h4 heading.
- H5
- An h5 heading.
- H6
- An h6 heading.
- HeadEntry
- Base class for all head entries.
- Header
- A semantic header container.
- Heading
- A heading element (h1-h6).
- HtmlElement
- Base class for HTML elements.
- Hydration
- Manages hydration from SSG to SPA.
- Image
- Displays an image.
- Input
- A text input field.
- LarkApp
- The root component for a Lark application.
- LarkColors
- Helper for defining colors.
- LarkConfig
- Lark application configuration.
- Link
- A navigation link.
- LinkEntry
- A link tag.
- Main
- A semantic main content container.
- Markdown
- Renders Markdown content as HTML.
- MetaEntry
- A meta tag.
- A semantic navigation container.
- Paragraph
- A text paragraph.
- PinInput
- A PIN/OTP input field with individual character boxes.
- PlatformInfo
- Platform helpers used by shared framework code.
- Pressable
- A pressable area (Universal Primitive).
- PrimitiveComponent
- Marker interface for primitive components (leaf nodes).
-
Provider<
T> - Provides a value to descendant components.
-
ProvideRef<
T> - Provides a reactive ref to descendants.
- RawHtml
- A component that renders raw HTML strings.
- ReactiveNode
- Represents a node in the reactive dependency graph.
- ReactiveScope
- Manages the current reactive subscriber context.
-
ReadonlyRef<
T> - Read-only component of a reactive ref.
-
Ref<
T> - A reactive container that holds a value and notifies on change.
- Row
- A horizontal flex container.
- ScriptEntry
- A script tag.
- Section
- A semantic section container.
- Slider
- A range slider input.
- Style
- A record type containing all supported CSS properties.
- StyleEntry
- An inline style tag.
- StyleRegistry
- Subscriber
- Represents a reactive consumer that can be notified of dependency changes.
- SubscriberStats
- Tracks statistics about a subscriber for debugging and profiling.
- Svg
- Displays an SVG image.
- Table
- A data table.
- TableBody
- Table body section.
- TableCaption
- Table caption.
- TableCell
- Table data cell.
- Table footer section.
- TableHead
- Table header cell.
- TableHeader
- Table header section.
- TableRow
- Table row.
- TailwindConfig
- Configuration for the Tailwind engine.
- Text
- A text span (Universal Primitive).
- TextArea
- A multi-line text input.
- TextLeaf
- Internal leaf node for text content.
- Theme
- Theme definition containing colors, spacing, and other design tokens.
- ThemeColors
- Color tokens for theming.
- ThemeConfig
- Defines a strongly-typed theme configuration for Lark Tailwind.
- ThemeRadius
- Border radius tokens.
- ThemeSpacing
- Spacing tokens.
- ThemeTypography
- Typography tokens.
- Time
- A time element with machine-readable datetime.
- TitleEntry
- The page title.
- Video
- Displays a video.
Enums
- AlignContent
-
Values for
align-contentproperty. - AlignItems
-
Values for
align-itemsproperty. - AlignSelf
-
Values for
align-selfproperty. - AnimationDirection
-
Values for
animation-directionproperty. - AnimationFillMode
-
Values for
animation-fill-modeproperty. - AnimationPlayState
-
Values for
animation-play-stateproperty. - BackfaceVisibility
-
Values for
backface-visibilityproperty. - BackgroundAttachment
-
Values for
background-attachmentproperty. - BackgroundClip
-
Values for
background-clipproperty. - BackgroundOrigin
-
Values for
background-originproperty. - BackgroundRepeat
-
Values for
background-repeatproperty. - BackgroundSize
-
Values for
background-sizeproperty (keywords only). - BlendMode
-
Values for
background-blend-modeandmix-blend-modeproperties. - BorderCollapse
-
Values for
border-collapseproperty. - BorderStyle
- Values for border style properties.
- BoxSizing
-
Values for
box-sizingproperty. - ButtonGroupOrientation
- CalendarMode
- CaptionSide
-
Values for
caption-sideproperty. - Clear
-
Values for
clearproperty. - CssTextAlign
-
Values for
text-alignproperty. - Cursor
-
Values for
cursorproperty. - DarkMode
- Dark mode strategy for Tailwind.
- Direction
-
Values for
directionproperty. - Display
-
Values for
displayproperty. - EmptyCells
-
Values for
empty-cellsproperty. - FlexDirection
-
Values for
flex-directionproperty. - FlexWrap
-
Values for
flex-wrapproperty. - Float
-
Values for
floatproperty. - FontKerning
-
Values for
font-kerningproperty. - FontStretch
-
Values for
font-stretchproperty. - FontStyle
-
Values for
font-styleproperty. - FontVariant
-
Values for
font-variantproperty. - FontWeight
-
Values for
font-weightproperty (keywords only). - GridAutoFlow
-
Values for
grid-auto-flowproperty. - HeadCategory
- Tag categories for grouping and deduplication.
- HeadLayer
- Priority layers for tag resolution. Higher priority layers override lower ones for tags with the same key.
- HydrationState
- Hydration state.
- Hyphens
-
Values for
hyphensproperty. - ImageFit
- ImageRendering
-
Values for
image-renderingproperty. - InputType
- Isolation
-
Values for
isolationproperty. - JustifyContent
-
Values for
justify-contentproperty. - LarkPlatform
- Supported runtime platforms.
- ListStylePosition
-
Values for
list-style-positionproperty. - ListStyleType
-
Values for
list-style-typeproperty. - ObjectFit
-
Values for
object-fitproperty. - Overflow
-
Values for
overflowproperties. - PageBreak
-
Values for
page-break-afterandpage-break-beforeproperties. - PageBreakInside
-
Values for
page-break-insideproperty. - PointerEvents
-
Values for
pointer-eventsproperty. - Position
-
Values for
positionproperty. - Resize
-
Values for
resizeproperty. - ScrollBehavior
-
Values for
scroll-behaviorproperty. - TableLayout
-
Values for
table-layoutproperty. - TableSortDirection
- TextAlignLast
-
Values for
text-align-lastproperty. - TextDecorationLine
-
Values for
text-decoration-lineproperty. - TextDecorationStyle
-
Values for
text-decoration-styleproperty. - TextJustify
-
Values for
text-justifyproperty. - TextOverflow
-
Values for
text-overflowproperty (keywords only). - TextTransform
-
Values for
text-transformproperty. - TransformStyle
-
Values for
transform-styleproperty. - UserSelect
-
Values for
user-selectproperty. - Visibility
-
Values for
visibilityproperty. - WhiteSpace
-
Values for
white-spaceproperty. - WordBreak
-
Values for
word-breakproperty. - WordWrap
-
Values for
word-wrap/overflow-wrapproperty. - WritingMode
-
Values for
writing-modeproperty.
Properties
- isHydrated → bool
-
Whether hydration is complete.
no setter
- isHydrating → bool
-
Whether currently hydrating.
no setter
- styleRegistry → StyleRegistry
-
Global style registry.
final
Functions
-
batch<
T> (T fn()) → T - Groups multiple ref updates into a single notification cycle.
-
computed<
T> (T compute(), {EqualityFn< T> ? equals, String? name}) → Computed<T> - Creates a new computed value that automatically tracks dependencies.
-
effect(
EffectFn fn, {String? name}) → void Function() - Creates and runs a new reactive effect.
-
hydrateApp(
Component root, String selector) → Future< void> - Hydrates an SSG pre-rendered app.
-
onMount(
CleanupFn? fn()) → void Function() - Creates an effect that only runs once on mount.
-
ref<
T> (T initialValue, {EqualityFn< T> ? equals, String? name}) → Ref<T> - Creates a new reactive ref with the given initial value.
-
setRefRegistrationCallback(
void callback(Ref, String?)) → void - Sets the ref registration callback (called by store module).
-
setTheme(
Theme theme) → void - Sets the current theme.
-
untrack<
T> (T fn()) → T - Runs a function without tracking any dependencies.
-
useContext<
T> () → T -
Retrieves a provided value of type
T. -
useContextOrNull<
T> () → T? -
Retrieves a provided value of type
T, or null if not found. -
useContextRef<
T> () → Ref< T> -
Retrieves a provided reactive ref of type
T. -
useContextRefOrNull<
T> () → Ref< T> ? -
Retrieves a provided reactive ref of type
T, or null if not found. -
useTheme(
) → Theme - Gets the current theme.
Typedefs
- CleanupFn = void Function()
- Represents a cleanup function returned from an effect.
- EffectFn = CleanupFn? Function()
- A function that can optionally return a cleanup function.
-
EqualityFn<
T> = bool Function(T previous, T next) - A function that compares two values for equality.
- RebuildCallback = void Function()
- Callback for when a component needs to rebuild.
Exceptions / Errors
- RouteNotFoundException
- Thrown when no route matches the current path.