resolveDataSourceRows static method

dynamic resolveDataSourceRows(
  1. dynamic dataSource,
  2. Map<String, dynamic> scope
)

Implementation

static dynamic resolveDataSourceRows(dynamic dataSource, Map<String, dynamic> scope) {
  if (dataSource is List) {
    return dataSource;
  }
  if (dataSource is String) {
    final bound = resolvePath(dataSource, scope);
    if (bound is List) return bound;
    if (scope.containsKey('data') && scope['data'] is Map) {
      final dataMap = scope['data'] as Map;
      if (dataMap.containsKey(dataSource) && dataMap[dataSource] is List) {
        return dataMap[dataSource];
      }
    }
  }
  if (dataSource is Map && dataSource.containsKey(r'$bind')) {
    final bound = resolveBinding(dataSource, scope);
    if (bound is List) return bound;
  }
  return null;
}