@@ -36,7 +36,7 @@ class AndroidIntent {
3636 this .arguments,
3737 this .package,
3838 this .componentName,
39- Platform platform,
39+ Platform ? platform,
4040 this .type,
4141 }) : assert (action != null || componentName != null ,
4242 'action or component (or both) must be specified' ),
@@ -47,8 +47,8 @@ class AndroidIntent {
4747 /// app code, it may break without warning.
4848 @visibleForTesting
4949 AndroidIntent .private ({
50- @ required Platform platform,
51- @ required MethodChannel channel,
50+ required Platform platform,
51+ required MethodChannel channel,
5252 this .action,
5353 this .flags,
5454 this .category,
@@ -66,47 +66,47 @@ class AndroidIntent {
6666 /// includes constants like `ACTION_VIEW` .
6767 ///
6868 /// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
69- final String action;
69+ final String ? action;
7070
7171 /// Constants that can be set on an intent to tweak how it is finally handled.
7272 /// Some of the constants are mirrored to Dart via [Flag] .
7373 ///
7474 /// See https://developer.android.com/reference/android/content/Intent.html#setFlags(int).
75- final List <int > flags;
75+ final List <int >? flags;
7676
7777 /// An optional additional constant qualifying the given [action] .
7878 ///
7979 /// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
80- final String category;
80+ final String ? category;
8181
8282 /// The Uri that the [action] is pointed towards.
8383 ///
8484 /// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
85- final String data;
85+ final String ? data;
8686
8787 /// The equivalent of `extras` , a generic `Bundle` of data that the Intent can
8888 /// carry. This is a slot for extraneous data that the listener may use.
8989 ///
9090 /// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
91- final Map <String , dynamic > arguments;
91+ final Map <String , dynamic >? arguments;
9292
9393 /// Sets the [data] to only resolve within this given package.
9494 ///
9595 /// See https://developer.android.com/reference/android/content/Intent.html#setPackage(java.lang.String).
96- final String package;
96+ final String ? package;
9797
9898 /// Set the exact `ComponentName` that should handle the intent. If this is
9999 /// set [package] should also be non-null.
100100 ///
101101 /// See https://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName).
102- final String componentName;
102+ final String ? componentName;
103103 final MethodChannel _channel;
104104 final Platform _platform;
105105
106106 /// Set an explicit MIME data type.
107107 ///
108108 /// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
109- final String type;
109+ final String ? type;
110110
111111 bool _isPowerOfTwo (int x) {
112112 /* First x in the below expression is for the case when x is 0 */
@@ -146,17 +146,18 @@ class AndroidIntent {
146146 return false ;
147147 }
148148
149- return await _channel.invokeMethod <bool >(
149+ final result = await _channel.invokeMethod <bool >(
150150 'canResolveActivity' ,
151151 _buildArguments (),
152152 );
153+ return result! ;
153154 }
154155
155156 /// Constructs the map of arguments which is passed to the plugin.
156157 Map <String , dynamic > _buildArguments () {
157158 return {
158159 if (action != null ) 'action' : action,
159- if (flags != null ) 'flags' : convertFlags (flags),
160+ if (flags != null ) 'flags' : convertFlags (flags! ),
160161 if (category != null ) 'category' : category,
161162 if (data != null ) 'data' : data,
162163 if (arguments != null ) 'arguments' : arguments,
0 commit comments