removeAliasPrefix<T> function

Map<String, T>? removeAliasPrefix<T>(
  1. Map<String, T?>? map
)

Remove alias prefix (underscore) used in graphQL requests

Implementation

Map<String, T>? removeAliasPrefix<T>(Map<String, T?>? map) {
  if (map == null) {
    return null;
  }
  final mapResult = <String, T>{};
  map.forEach((key, value) {
    if (value != null) {
      mapResult[key.replaceFirst('_', '')] = value;
    }
  });
  return mapResult;
}