You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The profile for the connection currently used to connect the machine to the Internet, or null if there is no connection profile with a suitable connection.
Here is an example that calls this method (make sure you are disconnected from the internet):
import'package:win32/winrt.dart';
classConnectionProfileextendsIInspectable {
ConnectionProfile.fromRawPointer(super.ptr);
}
ConnectionProfilegetInternetConnectionProfile() {
final activationFactoryPtr =CreateActivationFactory(
'Windows.Networking.Connectivity.NetworkInformation',
IID_INetworkInformationStatics);
final object =INetworkInformationStatics.fromRawPointer(activationFactoryPtr);
try {
returnConnectionProfile.fromRawPointer(
object.getInternetConnectionProfile());
} finally {
object.release();
}
}
voidmain() {
final profile =getInternetConnectionProfile();
print(profile.runtimeClassName); // The program will exit with an Access Violation error code
}
There is no information on WinMD files on whether a method/property can return null or not. That's why we need to mark methods/properties that return WinRT objects (except async delegates e.g. IAsyncAction, collection interfaces e.g. IVector, IMap etc., and methods from XXFactory interfaces) as nullable (see microsoft/windows-rs#331).
I actually did a similar thing in #465. FileOpenPicker's pickSingleFileAsync() returns IAsyncOperation<StorageFile>. Since the type argument is a WinRT object, we consider it nullable and expose it as Future<StorageFile?>. As pickMultipleFilesAsync() returns IAsyncOperation<IVectorView<StorageFile>> and the type argument is a collection interface we don't consider it nullable and expose it as Future<List<StorageFile>>.
The text was updated successfully, but these errors were encountered:
For example, NetworkInformation.GetInternetConnectionProfile Method states:
Here is an example that calls this method (make sure you are disconnected from the internet):
There is no information on WinMD files on whether a method/property can return null or not. That's why we need to mark methods/properties that return WinRT objects (except async delegates e.g.
IAsyncAction
, collection interfaces e.g.IVector
,IMap
etc., and methods fromXXFactory
interfaces) as nullable (see microsoft/windows-rs#331).I actually did a similar thing in #465. FileOpenPicker's pickSingleFileAsync() returns
IAsyncOperation<StorageFile>
. Since the type argument is a WinRT object, we consider it nullable and expose it asFuture<StorageFile?>
. As pickMultipleFilesAsync() returnsIAsyncOperation<IVectorView<StorageFile>>
and the type argument is a collection interface we don't consider it nullable and expose it asFuture<List<StorageFile>>
.The text was updated successfully, but these errors were encountered: