@@ -36,7 +36,7 @@ class AndroidIntent {
36
36
this .arguments,
37
37
this .package,
38
38
this .componentName,
39
- Platform platform,
39
+ Platform ? platform,
40
40
this .type,
41
41
}) : assert (action != null || componentName != null ,
42
42
'action or component (or both) must be specified' ),
@@ -47,8 +47,8 @@ class AndroidIntent {
47
47
/// app code, it may break without warning.
48
48
@visibleForTesting
49
49
AndroidIntent .private ({
50
- @ required Platform platform,
51
- @ required MethodChannel channel,
50
+ required Platform platform,
51
+ required MethodChannel channel,
52
52
this .action,
53
53
this .flags,
54
54
this .category,
@@ -66,47 +66,47 @@ class AndroidIntent {
66
66
/// includes constants like `ACTION_VIEW` .
67
67
///
68
68
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
69
- final String action;
69
+ final String ? action;
70
70
71
71
/// Constants that can be set on an intent to tweak how it is finally handled.
72
72
/// Some of the constants are mirrored to Dart via [Flag] .
73
73
///
74
74
/// See https://developer.android.com/reference/android/content/Intent.html#setFlags(int).
75
- final List <int > flags;
75
+ final List <int >? flags;
76
76
77
77
/// An optional additional constant qualifying the given [action] .
78
78
///
79
79
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
80
- final String category;
80
+ final String ? category;
81
81
82
82
/// The Uri that the [action] is pointed towards.
83
83
///
84
84
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
85
- final String data;
85
+ final String ? data;
86
86
87
87
/// The equivalent of `extras` , a generic `Bundle` of data that the Intent can
88
88
/// carry. This is a slot for extraneous data that the listener may use.
89
89
///
90
90
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
91
- final Map <String , dynamic > arguments;
91
+ final Map <String , dynamic >? arguments;
92
92
93
93
/// Sets the [data] to only resolve within this given package.
94
94
///
95
95
/// See https://developer.android.com/reference/android/content/Intent.html#setPackage(java.lang.String).
96
- final String package;
96
+ final String ? package;
97
97
98
98
/// Set the exact `ComponentName` that should handle the intent. If this is
99
99
/// set [package] should also be non-null.
100
100
///
101
101
/// See https://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName).
102
- final String componentName;
102
+ final String ? componentName;
103
103
final MethodChannel _channel;
104
104
final Platform _platform;
105
105
106
106
/// Set an explicit MIME data type.
107
107
///
108
108
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
109
- final String type;
109
+ final String ? type;
110
110
111
111
bool _isPowerOfTwo (int x) {
112
112
/* First x in the below expression is for the case when x is 0 */
@@ -146,17 +146,18 @@ class AndroidIntent {
146
146
return false ;
147
147
}
148
148
149
- return await _channel.invokeMethod <bool >(
149
+ final result = await _channel.invokeMethod <bool >(
150
150
'canResolveActivity' ,
151
151
_buildArguments (),
152
152
);
153
+ return result! ;
153
154
}
154
155
155
156
/// Constructs the map of arguments which is passed to the plugin.
156
157
Map <String , dynamic > _buildArguments () {
157
158
return {
158
159
if (action != null ) 'action' : action,
159
- if (flags != null ) 'flags' : convertFlags (flags),
160
+ if (flags != null ) 'flags' : convertFlags (flags! ),
160
161
if (category != null ) 'category' : category,
161
162
if (data != null ) 'data' : data,
162
163
if (arguments != null ) 'arguments' : arguments,
0 commit comments