Breakpoints class final

A project's breakpoints, narrowest first (DESIGN.md §5.3).

Always ordered by Breakpoint.minWidth with unique min widths and ids, the first starting at 0 (it covers everything below the second): the constructor normalizes whatever it's given. Never empty: no breakpoints are defaults.

Annotations
  • @immutable

Constructors

Breakpoints(Iterable<Breakpoint> items)
items normalized: entries with an id another took are dropped, then sorted by min width (one per min width, the first given kept), the first starting at 0. Empty gives defaults.
factory

Properties

first → Breakpoint
no setter
hashCode → int
The hash code for this object.
no setteroverride
ids → Iterable<String>
no setter
isDefault → bool
Whether this is defaults (stored as nothing).
no setter
last → Breakpoint
no setter
length → int
no setter
list → List<Breakpoint>
Narrowest first.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Breakpoint b) → Breakpoints
The set with b added (a min width another has moves it up by one).
at(double width) → Breakpoint?
The breakpoint whose min width is exactly width, if any.
byId(String? id) → Breakpoint?
The breakpoint with id.
find(String? key) → Breakpoint?
The breakpoint key names: an id, else a name (or its Breakpoint.key), compared without case.
forWidth(double width, [Map<String, double> minWidths = const {}]) → Breakpoint
The breakpoint width falls in: the last one, in order, whose min width is at or below it, else the first. minWidths (id → min width) moves some breakpoints' switch points (a node's or canvas's own, DESIGN.md §5.3); the order stays the set's, and a breakpoint it doesn't move starts no earlier than the one before it as moved (a node that moves desktop to 1200 isn't on a wider breakpoint at 1150).
governing(String id, Iterable<String> candidates) → String?
Of candidates (breakpoint ids: what a responsive variance's variants or a per-breakpoint value name), the one that governs breakpoint id: id itself, else the widest one narrower than it, else the narrowest (each covers from its breakpoint up to the next candidate's: min-width semantics, as a screen's canvases). On the default three it is the nearest breakpoint (the narrower on a tie), and a breakpoint no candidate names changes nothing. Ids not in the set are ignored; null when none is in it (or id isn't).
indexOf(String? id) → int
The position of id (narrowest 0), or -1.
move(String id, int by) → Breakpoints
The set with id moved by places (−1: narrower), keeping the ranges where they are: it swaps ranges (min widths) with the breakpoints it passes.
nearest(String id, Iterable<String> candidates) → String?
Of candidates (breakpoint ids), the one nearest to id in order: id itself, else the fewest steps away, the narrower on a tie. Ids not in the set are ignored. Null when none is. (Variances resolve by governing, which agrees with this on three breakpoints.)
newId([String base = 'bp']) → String
A new id for a breakpoint of this set.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String id) → Breakpoints
The set without id (the last one stays).
toJson() → List<Json>
toString() → String
A string representation of this object.
override
update(String id, Breakpoint f(Breakpoint b)) → Breakpoints
The set with breakpoint id replaced by f of it.

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Properties

defaults → Breakpoints
What a new project gets (and a project without any): mobile, tablet and desktop, as editable data.
final

Static Methods

fromJson(Object? json) → Breakpoints
Decodes a list of breakpoints; nothing usable gives defaults.

Constants

codec → const ListCodec<Breakpoint>
The breakpoints' field declarations, as a list prop (for panels).