Nutrient 3.9 migration guide

Nutrient Flutter SDK 3.9 introduces a new way to configure the measurement scale and precision using the MeasurementValueConfiguration object. The old way of configuring the measurement scale and precision, using PspdfkitWidgetController.setMeasurementScale and PspdfkitWidgetController.setMeasurementPrecision, has been removed. This follows the removal of the same APIs in the native SDKs that the Flutter plugin is based on.

If you were using version 3.8.* or earlier, you’ll need to update the way you configure measurement scale and precision in your code as shown in the example below.

Before version 3.9.0:

PspdfkitWidget(
        documentPath: widget.documentPath,
        onPspdfkitWidgetCreated: (controller) {
        // Set measurement scale and precision.
            controller.setMeasurementPrecision(MeasurementPrecision.fourDP);
            controller.setMeasurementScale(MeasurementScale(
                unitFrom: UnitFrom.cm,
                valueFrom: 1.0,
                unitTo: UnitTo.m,
                valueTo: 100.0));
        })

After version 3.9.0:

PspdfkitWidget(
        documentPath: widget.documentPath,
        // Set measurement scale and precision using `MeasurementValueConfiguration`.
        configuration: PdfConfiguration(measurementValueConfigurations: [
        MeasurementValueConfiguration(
            name: 'Custom Scale',
            precision: MeasurementPrecision.fourDP,
            scale: MeasurementScale(
                unitFrom: UnitFrom.cm,
                valueFrom: 1.0,
                unitTo: UnitTo.m,
                valueTo: 100.0))
        ]),
    )

Refer to the Nutrient Flutter SDK 3.9 changelog for more information.