rules/utils/config_utils library
Type-safe helpers for reading rule configuration from analysis_options.yaml.
Each helper extracts a value from the rule's JSON config map, returning null on type mismatch instead of throwing. This lets rule constructors use ?? to fall back to defaults cleanly.
Functions
-
configBool(
Map< String, Object?> json, String key) → bool? -
Reads a bool value from
jsonatkey. Returns null if missing or wrong type. -
configDouble(
Map< String, Object?> json, String key) → double? -
Reads a double value from
jsonatkey. Accepts both int and double. Returns null if missing or wrong type. -
configInt(
Map< String, Object?> json, String key) → int? -
Reads an int value from
jsonatkey. Returns null if missing or wrong type. -
configList(
Map< String, Object?> json, String key) → List? -
Reads a raw
Listfromjsonatkey. Returns null if missing or wrong type. -
configMapList(
Map< String, Object?> json, String key) → List<Map< ?String, dynamic> > -
Reads a
List<Map<String, dynamic>>fromjsonatkey. Returns null if missing or wrong type. -
configString(
Map< String, Object?> json, String key) → String? -
Reads a String value from
jsonatkey. Returns null if missing or wrong type. -
configStringList(
Map< String, Object?> json, String key) → List<String> ? -
Reads a
List<String>fromjsonatkey. Returns null if missing or wrong type. -
optionsJson(
Map< String, Object?> ? options) → Map<String, Object?> -
Extracts the JSON config map from
options, returning an empty map if null.