round property
Round a number to the nearest integer.
Implementation
static final round = DartBlockNativeFunction(
name: 'round',
returnType: DartBlockDataType.integerType,
parameters: [
DartBlockVariableDefinition('value', DartBlockDataType.doubleType),
],
implementation: (arbiter, args) {
final value = args[0].getValue(arbiter) as num;
return DartBlockAlgebraicExpression.fromConstant(value.round());
},
category: DartBlockNativeFunctionCategory.math,
type: DartBlockNativeFunctionType.round,
description: 'Round a number to the nearest integer.',
);