stringWithContentsOfURL static method
stringWithContentsOfURL:encoding:error:
Implementation
static NSString? stringWithContentsOfURL(NSURL url, {required int encoding}) {
final $err = pkg_ffi.calloc<ffi.Pointer<objc.ObjCObjectImpl>>();
try {
final $ret = _objc_msgSend_1nomli1(
_class_NSString,
_sel_stringWithContentsOfURL_encoding_error_,
url.ref.pointer,
encoding,
$err,
);
objc.NSErrorException.checkErrorPointer($err.value);
return $ret.address == 0
? null
: NSString.fromPointer($ret, retain: true, release: true);
} finally {
pkg_ffi.calloc.free($err);
}
}