unpackString method Null safety

  1. @Deprecated('Use the toDartString method in package:ffi 1.0 instead.')
String unpackString(
  1. int maxLength
)
@Deprecated('Use the toDartString method in package:ffi 1.0 instead.')

Implementation

@Deprecated('Use the toDartString method in package:ffi 1.0 instead.')
String unpackString(int maxLength) {
  final pathData = cast<Uint16>().asTypedList(maxLength);

  var stringLength = pathData.indexOf(0);
  if (stringLength == -1) {
    stringLength = maxLength;
  }

  return String.fromCharCodes(pathData, 0, stringLength);
}