initWithContentsOfFile method
initWithContentsOfFile:encoding:error:
Implementation
NSString? initWithContentsOfFile(NSString path, {required int encoding}) {
final $err = pkg_ffi.calloc<ffi.Pointer<objc.ObjCObjectImpl>>();
try {
final $ret = _objc_msgSend_1nomli1(
object$.ref.retainAndReturnPointer(),
_sel_initWithContentsOfFile_encoding_error_,
path.ref.pointer,
encoding,
$err,
);
objc.NSErrorException.checkErrorPointer($err.value);
return $ret.address == 0
? null
: NSString.fromPointer($ret, retain: false, release: true);
} finally {
pkg_ffi.calloc.free($err);
}
}