NmTableUrlState class
A table route's state in the URL: f (filter conditions), q (a raw filter, e.g. from a saved search), sort,
page, size and cols. Reloading or sharing the URL restores the view.
f is compact: conditions field:op:value joined by ;; %, : and ; inside a value are escaped as %25,
%3A and %3B (on top of the URL encoding of the whole parameter).
- Annotations
Constructors
-
NmTableUrlState({List<
NmFilterCondition> filters = const [], String? raw, String? sort, int page = 1, int size = 50, List<String> ? columns, List<int> sizes = defaultSizes, int defaultSize = 50}) -
Creates a state.
const
-
NmTableUrlState.fromQuery(Map<
String, String> q, {List<int> sizes = defaultSizes, int defaultSize = 50}) -
Reads the query parameters of a route.
factory
Properties
-
columns
→ List<
String> ? -
Visible column ids; null means the table's defaults.
final
- defaultSize → int
-
Page size left out of the URL.
final
-
filters
→ List<
NmFilterCondition> -
Filter conditions.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- page → int
-
1-based page.
final
- raw → String?
-
q: a raw filter expression, combined with filters byand.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Page size.
final
-
sizes
→ List<
int> -
Allowed page sizes (fromQuery falls back to defaultSize for others).
final
- sort → String?
-
FieldorField desc.final
Methods
-
copyWith(
{List< NmFilterCondition> ? filters, bool clearRaw = false, String? sort, bool clearSort = false, int? page, int? size, List<String> ? columns}) → NmTableUrlState - A copy with the given fields replaced.
-
filterExpression(
{Set< String> numericFields = const {}}) → String? - The filter for the API: raw and the OData form of filters, combined.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toQuery(
) → Map< String, String> - Query parameters; defaults are left out so URLs stay short.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
combine(
String? a, String? b) → String? -
(a) and (b), or whichever is present. -
decodeFilters(
String? raw) → List< NmFilterCondition> -
Reads the compact
fform; malformed conditions are skipped. -
encodeFilters(
List< NmFilterCondition> filters) → String -
The compact
fform offilters. -
odataFilter(
List< NmFilterCondition> filters, {Set<String> numericFields = const {}}) → String? -
OData form of
filters, e.g.State eq 'FL' and Value lt 100000: strings quoted (quotes doubled), numbers ofnumericFieldsand booleans bare,contains/startswithas functions. Null whenfiltersis empty.
Constants
-
defaultSizes
→ const List<
int> - Page sizes offered by default.