roundNested function

dynamic roundNested(
  1. dynamic x
)

Recursively rounds every number in a (possibly nested) list to the nearest integer, preserving the nesting structure.

Implementation

dynamic roundNested(dynamic x) => x is List
    ? [for (final dynamic e in x) roundNested(e)]
    : (x as num).round();