NWRefresh class

Downloads JSON every every and saves values from it into fields, natively, while the app is closed.

refresh: NWRefresh(
  url: 'https://api.example.com/weather?city={city}',
  values: {'temp': 'current.temp', 'title#': 'items.#.title'},
),
  • url may use {key} of fields and options. With an option in it, each choice is downloaded and saved on its own.
  • values maps a field key to a path in the JSON: object keys and list indexes separated by dots. For a repeated field, # in both is the index ('title#': 'items.#.title').
  • The system decides the exact time. iOS allows about 40–70 refreshes a day, so every is at least 15 minutes; Android also wakes it then. iOS only allows https URLs.

Constructors

NWRefresh({required String url, required Map<String, String> values, Duration every = const Duration(minutes: 30), Map<String, String> headers = const {}})
const

Properties

every → Duration
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, String>
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
url → String
final
values → Map<String, String>
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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