Skip to content

Commit 6b5c20b

Browse files
committed
refactored changes
1 parent ccd7277 commit 6b5c20b

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

lib/flutter_shortcuts.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class FlutterShortcuts {
2222
}
2323

2424
/// [listenAction] performs action when shortcut is initiated.
25-
Future<void> listenAction(FlutterShortcutAction action) async {
25+
Future<void> listenAction(ShortcutAction action) async {
2626
FlutterShortcutsPlatform.instance.listenAction(action);
2727
}
2828

@@ -40,7 +40,7 @@ class FlutterShortcuts {
4040

4141
/// [setShortcutItems] will set all the shortcut items.
4242
Future<void> setShortcutItems(
43-
{required List<FlutterShortcutItem> shortcutItems}) async {
43+
{required List<ShortcutItem> shortcutItems}) async {
4444
return FlutterShortcutsPlatform.instance.setShortcutItems(shortcutItems);
4545
}
4646

@@ -52,28 +52,27 @@ class FlutterShortcuts {
5252
/// [pushShortcutItem] will push a new shortcut item.
5353
/// If there is already a dynamic or pinned shortcut with the same ID,
5454
/// the shortcut will be updated and pushed at the end of the shortcut list.
55-
Future<void> pushShortcutItem({required FlutterShortcutItem shortcut}) async {
55+
Future<void> pushShortcutItem({required ShortcutItem shortcut}) async {
5656
return FlutterShortcutsPlatform.instance.pushShortcutItem(shortcut);
5757
}
5858

5959
/// [pushShortcutItems] updates dynamic or pinned shortcuts with same IDs
6060
/// and pushes new shortcuts with different IDs.
6161
Future<void> pushShortcutItems(
62-
{required List<FlutterShortcutItem> shortcutList}) async {
62+
{required List<ShortcutItem> shortcutList}) async {
6363
return FlutterShortcutsPlatform.instance.pushShortcutItems(shortcutList);
6464
}
6565

6666
/// [updateShortcutItems] updates shortcut items.
6767
/// If the IDs of the shortcuts are not same, no changes will be reflected.
6868
Future<void> updateShortcutItems(
69-
{required List<FlutterShortcutItem> shortcutList}) async {
69+
{required List<ShortcutItem> shortcutList}) async {
7070
return FlutterShortcutsPlatform.instance.updateShortcutItems(shortcutList);
7171
}
7272

7373
/// [updateShortcutItem] updates a single shortcut item based on id.
7474
/// If the ID of the shortcut is not same, no changes will be reflected.
75-
Future<void> updateShortcutItem(
76-
{required FlutterShortcutItem shortcut}) async {
75+
Future<void> updateShortcutItem({required ShortcutItem shortcut}) async {
7776
return FlutterShortcutsPlatform.instance.updateShortcutItem(shortcut);
7877
}
7978

lib/src/helper/helper.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ for more details.
88
99
*/
1010

11-
export 'action/flutter_shortcut_action.dart';
12-
export 'model/flutter_shortcut_item.dart';
11+
export 'action/shortcut_action.dart';
12+
export 'model/shortcut_item.dart';
1313
export 'enums/shortcut_icon_asset.dart';

lib/src/method_call/flutter_shortcuts_method_call_handler.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FlutterShortcutsMethodCallHandler extends FlutterShortcutsPlatform {
2828
}
2929

3030
@override
31-
Future<void> listenAction(FlutterShortcutAction actionHandler) async {
31+
Future<void> listenAction(ShortcutAction actionHandler) async {
3232
channel.setMethodCallHandler((MethodCall call) async {
3333
assert(call.method == 'launch');
3434
actionHandler(call.arguments);
@@ -52,7 +52,7 @@ class FlutterShortcutsMethodCallHandler extends FlutterShortcutsPlatform {
5252
}
5353

5454
@override
55-
Future<void> setShortcutItems(List<FlutterShortcutItem> items) async {
55+
Future<void> setShortcutItems(List<ShortcutItem> items) async {
5656
final List<Map<String, dynamic>> itemsList =
5757
items.map((item) => item.serialize()).toList();
5858
await channel.invokeMethod<void>('setShortcutItems', itemsList);
@@ -64,27 +64,27 @@ class FlutterShortcutsMethodCallHandler extends FlutterShortcutsPlatform {
6464
}
6565

6666
@override
67-
Future<void> pushShortcutItem(FlutterShortcutItem shortcut) async {
67+
Future<void> pushShortcutItem(ShortcutItem shortcut) async {
6868
final Map<String, dynamic> item = shortcut.serialize();
6969
await channel.invokeMethod<void>('pushShortcutItem', [item]);
7070
}
7171

7272
@override
73-
Future<void> pushShortcutItems(List<FlutterShortcutItem> items) async {
73+
Future<void> pushShortcutItems(List<ShortcutItem> items) async {
7474
final List<Map<String, dynamic>> itemsList =
7575
items.map((item) => item.serialize()).toList();
7676
await channel.invokeMethod<void>('pushShortcutItems', itemsList);
7777
}
7878

7979
@override
80-
Future<void> updateShortcutItems(List<FlutterShortcutItem> items) async {
80+
Future<void> updateShortcutItems(List<ShortcutItem> items) async {
8181
final List<Map<String, dynamic>> itemsList =
8282
items.map((item) => item.serialize()).toList();
8383
await channel.invokeMethod<void>('updateShortcutItems', itemsList);
8484
}
8585

8686
@override
87-
Future<void> updateShortcutItem(FlutterShortcutItem shortcut) async {
87+
Future<void> updateShortcutItem(ShortcutItem shortcut) async {
8888
final Map<String, dynamic> item = shortcut.serialize();
8989
await channel.invokeMethod<void>('updateShortcutItem', [item]);
9090
}

lib/src/platform/flutter_shortcuts_platform.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract class FlutterShortcutsPlatform extends PlatformInterface {
3232
throw UnimplementedError("initialize() has not been implemented.");
3333
}
3434

35-
Future<void> listenAction(FlutterShortcutAction action) async {
35+
Future<void> listenAction(ShortcutAction action) async {
3636
throw UnimplementedError("listenAction() has not been implemented.");
3737
}
3838

@@ -44,27 +44,27 @@ abstract class FlutterShortcutsPlatform extends PlatformInterface {
4444
throw UnimplementedError("getIconProperties() has not been implemented.");
4545
}
4646

47-
Future<void> setShortcutItems(List<FlutterShortcutItem> items) async {
47+
Future<void> setShortcutItems(List<ShortcutItem> items) async {
4848
throw UnimplementedError("setShortcutItems() has not been implemented.");
4949
}
5050

5151
Future<void> clearShortcutItems() async {
5252
throw UnimplementedError("clearShortcutItems() has not been implemented.");
5353
}
5454

55-
Future<void> pushShortcutItem(FlutterShortcutItem shortcut) async {
55+
Future<void> pushShortcutItem(ShortcutItem shortcut) async {
5656
throw UnimplementedError("pushShortcutItem() has not been implemented.");
5757
}
5858

59-
Future<void> pushShortcutItems(List<FlutterShortcutItem> items) async {
59+
Future<void> pushShortcutItems(List<ShortcutItem> items) async {
6060
throw UnimplementedError("pushShortcutItems() has not been implemented.");
6161
}
6262

63-
Future<void> updateShortcutItems(List<FlutterShortcutItem> items) async {
63+
Future<void> updateShortcutItems(List<ShortcutItem> items) async {
6464
throw UnimplementedError("updateShortcutItems() has not been implemented.");
6565
}
6666

67-
Future<void> updateShortcutItem(FlutterShortcutItem shortcut) async {
67+
Future<void> updateShortcutItem(ShortcutItem shortcut) async {
6868
throw UnimplementedError("updateShortcutItem() has not been implemented.");
6969
}
7070

0 commit comments

Comments
 (0)