Dart - kv.keys()
Return an async iterable of keys in the store.
import 'package:nitric_sdk/nitric.dart';final profiles = Nitric.kv("profiles").allow([KeyValueStorePermission.get,]);final keys = await profiles.keys();keys.forEach((String key) {// do something with the key});
Parameters
- Name
prefix
- Optional
- Optional
- Type
- String
- Description
The prefix to filter keys by, if not provided all keys will be returned.
Examples
Get all keys from a key value store
import 'package:nitric_sdk/nitric.dart';final profiles = Nitric.kv("profiles").allow([KeyValueStorePermission.get,]);final keys = await profiles.keys();keys.forEach((String key) {// do something with the key});
Get keys filtered by prefix from a key value store
import 'package:nitric_sdk/nitric.dart';final profiles = Nitric.kv("profiles").allow([KeyValueStorePermission.get,]);final keys = await profiles.keys("subprofile:");keys.forEach((String key) {// do something with the key});
Last updated on Dec 19, 2024