move method

Future<Object> move(
  1. Object tabIds,
  2. MoveProperties moveProperties
)

Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows. tabIds The tab ID or list of tab IDs to move.

Implementation

Future<Object> move(
  Object tabIds,
  MoveProperties moveProperties,
) async {
  var $res = await promiseToFuture<JSAny>($js.chrome.tabs.move(
    switch (tabIds) {
      int() => tabIds.jsify()!,
      List<int>() => tabIds.toJSArray((e) => e),
      _ => throw UnsupportedError(
          'Received type: ${tabIds.runtimeType}. Supported types are: int, List<int>')
    },
    moveProperties.toJS,
  ));
  return $res.when(
    isOther: (v) => Tab.fromJS((v as $js.Tab)),
    isArray: (v) =>
        v.toDart.cast<$js.Tab>().map((e) => Tab.fromJS(e)).toList(),
  );
}