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 (Box/Text/Image/Link/Icon, layout, interaction, base forms)
  • Reactivity (ref, computed, effect, batch)
  • Render engine
  • Styling
  • Theme system

Classes

AppShell
Internal shell for routing.
BaseEntry
The base href tag.
Box
Generic div wrapper.
BuildConfig
Build configuration.
CheckboxBase
Base checkbox.
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.
DialogController
Overlay visibility controller.
DismissableLayer
Layer that can be dismissed by outside interaction.
Effect
A reactive side effect that re-runs when dependencies change.
Empty
A component that renders nothing.
Expanded
Expands child in a flex context.
FocusScope
Focus scope container.
FocusTrap
Focus trap container.
Form
Base form 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.
HeadEntry
Base class for all head entries.
HoverRegion
Hover interaction region.
HtmlElement
Base class for HTML elements.
Hydration
Manages hydration from SSG to SPA.
Icon
Displays an icon from Lucide (default) or custom icon fonts.
Icons
Lucide icon names - 1666 icons.
IdProvider
ID scope wrapper.
Image
Displays an image.
InputBase
Base text input.
InputDecoration
Decoration metadata for consistent form field presentation.
Label
Label primitive for base forms.
LarkApp
The root component for a Lark application.
LarkColors
Helper for defining colors.
LarkConfig
Lark application configuration.
A navigation link.
LinkEntry
A link tag.
LiveRegion
Live region accessibility primitive.
Markdown
Renders Markdown content as HTML.
Menu visibility controller.
MetaEntry
A meta tag.
OptionBase<T>
Base option model for SelectBase.
Overlay
Generic overlay primitive.
OverlayConfig
Overlay behavior config attached to a rendered vnode.
Paragraph
Paragraph primitive.
PlatformInfo
Platform helpers used by shared framework code.
Portal
Portal primitive.
Pressable
Unstyled button-like 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.
RadioBase<T>
Base radio.
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.
RovingFocusGroup
Basic roving-focus wrapper.
Row
A horizontal flex container.
ScriptEntry
A script tag.
ScrollController
Imperative controller for a ScrollView.
ScrollView
A scrollable viewport container.
SelectBase<T>
Base select.
Slot
Slot primitive for composition.
Spacer
Unstyled spacing primitive.
Stack
A layered layout container.
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.
TailwindConfig
Configuration for the Tailwind engine.
Text
Text span primitive.
TextareaBase
Base textarea.
TextLeaf
Internal text leaf node.
Theme
Theme definition containing design tokens.
ThemeColors
Color tokens for theming.
ThemeConfig
Defines a strongly-typed theme configuration for Lark Tailwind.
ThemeProvider
Theme provider wrapper.
ThemeRadius
Border radius tokens.
ThemeShadows
Shadow tokens.
ThemeSpacing
Spacing tokens.
ThemeTypography
Typography tokens.
ThemeZIndex
Z-index tokens.
TitleEntry
The page title.
TooltipController
Tooltip visibility controller.

Enums

AlignContent
Values for align-content property.
AlignItems
Values for align-items property.
AlignSelf
Values for align-self property.
AnimationDirection
Values for animation-direction property.
AnimationFillMode
Values for animation-fill-mode property.
AnimationPlayState
Values for animation-play-state property.
BackfaceVisibility
Values for backface-visibility property.
BackgroundAttachment
Values for background-attachment property.
BackgroundClip
Values for background-clip property.
BackgroundOrigin
Values for background-origin property.
BackgroundRepeat
Values for background-repeat property.
BackgroundSize
Values for background-size property (keywords only).
BlendMode
Values for background-blend-mode and mix-blend-mode properties.
BorderCollapse
Values for border-collapse property.
BorderStyle
Values for border style properties.
BoxSizing
Values for box-sizing property.
CaptionSide
Values for caption-side property.
Clear
Values for clear property.
CssTextAlign
Values for text-align property.
Cursor
Values for cursor property.
DarkMode
Dark mode strategy for Tailwind.
Direction
Values for direction property.
Display
Values for display property.
EmptyCells
Values for empty-cells property.
FlexDirection
Values for flex-direction property.
FlexWrap
Values for flex-wrap property.
Float
Values for float property.
FontKerning
Values for font-kerning property.
FontStretch
Values for font-stretch property.
FontStyle
Values for font-style property.
FontVariant
Values for font-variant property.
FontWeight
Values for font-weight property (keywords only).
GridAutoFlow
Values for grid-auto-flow property.
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 hyphens property.
ImageFit
ImageRendering
Values for image-rendering property.
InputType
Native input type choices.
Isolation
Values for isolation property.
JustifyContent
Values for justify-content property.
LarkPlatform
Supported runtime platforms.
ListStylePosition
Values for list-style-position property.
ListStyleType
Values for list-style-type property.
ObjectFit
Values for object-fit property.
Overflow
Values for overflow properties.
OverlayAlign
Overlay positioning alignment.
OverlaySide
Overlay positioning side.
PageBreak
Values for page-break-after and page-break-before properties.
PageBreakInside
Values for page-break-inside property.
PointerEvents
Values for pointer-events property.
Position
Values for position property.
Resize
Values for resize property.
RovingOrientation
Roving focus group orientation.
ScrollAxis
Scroll axes for ScrollView.
ScrollBehavior
Values for scroll-behavior property.
SpacerAxis
Axis options for Spacer.
TableLayout
Values for table-layout property.
TextAlignLast
Values for text-align-last property.
TextDecorationLine
Values for text-decoration-line property.
TextDecorationStyle
Values for text-decoration-style property.
TextInputAction
Describes action semantics for Enter/submit behavior.
TextJustify
Values for text-justify property.
TextOverflow
Values for text-overflow property (keywords only).
TextTransform
Values for text-transform property.
TransformStyle
Values for transform-style property.
UserSelect
Values for user-select property.
Visibility
Values for visibility property.
WhiteSpace
Values for white-space property.
WordBreak
Values for word-break property.
WordWrap
Values for word-wrap / overflow-wrap property.
WritingMode
Values for writing-mode property.

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, {bool syncToDom = false, String selector = ':root', String prefix = 'lark'}) → void
Sets the current theme.
syncThemeToDom({String selector = ':root', String prefix = 'lark'}) → void
Applies current theme variables to the DOM when running on web.
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.
IconClassBuilder = String Function(String prefix, String name)
Resolves the CSS class used to render an icon glyph.
InputFormatter = String Function(String value)
Transforms raw text input before it is persisted.
Radius = ThemeRadius
Radius token alias.
RebuildCallback = void Function()
Callback for when a component needs to rebuild.
ScrollOffset = ({double x, double y})
Shadow = ThemeShadows
Shadow token alias.
Space = ThemeSpacing
Spacing token alias.
Typography = ThemeTypography
Typography token alias.

Exceptions / Errors

RouteNotFoundException
Thrown when no route matches the current path.