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.
- Link
- A navigation link.
- LinkEntry
- A link tag.
- LiveRegion
- Live region accessibility primitive.
- Markdown
- Renders Markdown content as HTML.
- MenuController
- 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-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. - 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
- Native input type choices.
- 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. - OverlayAlign
- Overlay positioning alignment.
- OverlaySide
- Overlay positioning side.
- 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. - RovingOrientation
- Roving focus group orientation.
- ScrollAxis
- Scroll axes for ScrollView.
- ScrollBehavior
-
Values for
scroll-behaviorproperty. - SpacerAxis
- Axis options for Spacer.
- TableLayout
-
Values for
table-layoutproperty. - TextAlignLast
-
Values for
text-align-lastproperty. - TextDecorationLine
-
Values for
text-decoration-lineproperty. - TextDecorationStyle
-
Values for
text-decoration-styleproperty. - TextInputAction
- Describes action semantics for Enter/submit behavior.
- 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, {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.