Skip to content

Commit

Permalink
Fix Dart 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrh committed Aug 16, 2024
1 parent cf4c1a0 commit 244c101
Show file tree
Hide file tree
Showing 61 changed files with 286 additions and 259 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.0

- Fix the package to work with Dart 3.5 & Flutter 3.24

## 0.3.1

- Expose `EventStream` class.
Expand Down
4 changes: 3 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ linter:
cast_nullable_to_non_nullable: true
close_sinks: true
conditional_uri_does_not_exist: true
# TODO: enable this lint
# invalid_runtime_check_with_js_interop_types: true
no_adjacent_strings_in_list: true
no_default_cases: true
no_leading_underscores_for_local_identifiers: true
Expand All @@ -28,4 +30,4 @@ linter:
unnecessary_parenthesis: true
unnecessary_statements: true
unsafe_html: true
use_raw_strings: true
use_raw_strings: true
2 changes: 1 addition & 1 deletion lib/action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class ChromeAction {
EventStream<Tab> get onClicked =>
$js.chrome.action.onClicked.asStream(($c) => ($js_tabs.Tab tab) {
return $c(Tab.fromJS(tab));
});
}.toJS);
}

class TabDetails {
Expand Down
2 changes: 1 addition & 1 deletion lib/alarms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ChromeAlarms {
EventStream<Alarm> get onAlarm =>
$js.chrome.alarms.onAlarm.asStream(($c) => ($js.Alarm alarm) {
return $c(Alarm.fromJS(alarm));
});
}.toJS);
}

class Alarm {
Expand Down
6 changes: 3 additions & 3 deletions lib/audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ChromeAudio {
$js.chrome.audio.onLevelChanged
.asStream(($c) => ($js.LevelChangedEvent event) {
return $c(LevelChangedEvent.fromJS(event));
});
}.toJS);

/// Fired when the mute state of the audio input or output changes.
/// Note that mute state is system-wide and the new value applies to every
Expand All @@ -96,7 +96,7 @@ class ChromeAudio {
$js.chrome.audio.onMuteChanged
.asStream(($c) => ($js.MuteChangedEvent event) {
return $c(MuteChangedEvent.fromJS(event));
});
}.toJS);

/// Fired when audio devices change, either new devices being added, or
/// existing devices being removed.
Expand All @@ -107,7 +107,7 @@ class ChromeAudio {
.cast<$js.AudioDeviceInfo>()
.map((e) => AudioDeviceInfo.fromJS(e))
.toList());
});
}.toJS);
}

/// Type of stream an audio device provides.
Expand Down
14 changes: 7 additions & 7 deletions lib/bookmarks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class ChromeBookmarks {
id: id,
bookmark: BookmarkTreeNode.fromJS(bookmark),
));
});
}.toJS);

/// Fired when a bookmark or folder is removed. When a folder is removed
/// recursively, a single notification is fired for the folder, and none for
Expand All @@ -176,7 +176,7 @@ class ChromeBookmarks {
id: id,
removeInfo: OnRemovedRemoveInfo.fromJS(removeInfo),
));
});
}.toJS);

/// Fired when a bookmark or folder changes. **Note:** Currently, only title
/// and url changes trigger this.
Expand All @@ -189,7 +189,7 @@ class ChromeBookmarks {
id: id,
changeInfo: OnChangedChangeInfo.fromJS(changeInfo),
));
});
}.toJS);

/// Fired when a bookmark or folder is moved to a different parent folder.
EventStream<OnMovedEvent> get onMoved =>
Expand All @@ -201,7 +201,7 @@ class ChromeBookmarks {
id: id,
moveInfo: OnMovedMoveInfo.fromJS(moveInfo),
));
});
}.toJS);

/// Fired when the children of a folder have changed their order due to the
/// order being sorted in the UI. This is not called as a result of a move().
Expand All @@ -214,21 +214,21 @@ class ChromeBookmarks {
id: id,
reorderInfo: OnChildrenReorderedReorderInfo.fromJS(reorderInfo),
));
});
}.toJS);

/// Fired when a bookmark import session is begun. Expensive observers should
/// ignore onCreated updates until onImportEnded is fired. Observers should
/// still handle other notifications immediately.
EventStream<void> get onImportBegan =>
$js.chrome.bookmarks.onImportBegan.asStream(($c) => () {
return $c(null);
});
}.toJS);

/// Fired when a bookmark import session is ended.
EventStream<void> get onImportEnded =>
$js.chrome.bookmarks.onImportEnded.asStream(($c) => () {
return $c(null);
});
}.toJS);
}

/// Indicates the reason why this node is unmodifiable. The [managed] value
Expand Down
2 changes: 1 addition & 1 deletion lib/browser_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class ChromeBrowserAction {
EventStream<Tab> get onClicked =>
$js.chrome.browserAction.onClicked.asStream(($c) => ($js_tabs.Tab tab) {
return $c(Tab.fromJS(tab));
});
}.toJS);
}

typedef ColorArray = List<int>;
Expand Down
8 changes: 4 additions & 4 deletions lib/certificate_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ChromeCertificateProvider {
$js.chrome.certificateProvider.onCertificatesUpdateRequested
.asStream(($c) => ($js.CertificatesUpdateRequest request) {
return $c(CertificatesUpdateRequest.fromJS(request));
});
}.toJS);

/// This event fires every time the browser needs to sign a message using a
/// certificate provided by this extension via [setCertificates].
Expand All @@ -89,7 +89,7 @@ class ChromeCertificateProvider {
$js.chrome.certificateProvider.onSignatureRequested
.asStream(($c) => ($js.SignatureRequest request) {
return $c(SignatureRequest.fromJS(request));
});
}.toJS);

/// This event fires every time the browser requests the current list of
/// certificates provided by this extension. The extension must call
Expand All @@ -115,7 +115,7 @@ class ChromeCertificateProvider {
.toList());
});
});
});
}.toJS);

/// This event fires every time the browser needs to sign a message using
/// a certificate provided by this extension in reply to an
Expand All @@ -137,7 +137,7 @@ class ChromeCertificateProvider {
(reportCallback as Function)(signature?.toJS);
},
));
});
}.toJS);
}

/// Types of supported cryptographic signature algorithms.
Expand Down
2 changes: 1 addition & 1 deletion lib/commands.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ChromeCommands {
command: command,
tab: tab?.let(Tab.fromJS),
));
});
}.toJS);
}

class Command {
Expand Down
2 changes: 1 addition & 1 deletion lib/context_menus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ChromeContextMenus {
info: OnClickData.fromJS(info),
tab: tab?.let(Tab.fromJS),
));
});
}.toJS);
}

/// The different contexts a menu can appear in. Specifying 'all' is equivalent
Expand Down
2 changes: 1 addition & 1 deletion lib/cookies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ChromeCookies {
EventStream<OnChangedChangeInfo> get onChanged => $js.chrome.cookies.onChanged
.asStream(($c) => ($js.OnChangedChangeInfo changeInfo) {
return $c(OnChangedChangeInfo.fromJS(changeInfo));
});
}.toJS);
}

/// A cookie's 'SameSite' state
Expand Down
4 changes: 2 additions & 2 deletions lib/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ChromeDebugger {
method: method,
params: params?.toDartMap(),
));
});
}.toJS);

/// Fired when browser terminates debugging session for the tab. This happens
/// when either the tab is being closed or Chrome DevTools is being invoked
Expand All @@ -112,7 +112,7 @@ class ChromeDebugger {
source: Debuggee.fromJS(source),
reason: DetachReason.fromJS(reason),
));
});
}.toJS);
}

/// Target type.
Expand Down
2 changes: 1 addition & 1 deletion lib/declarative_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChromeDeclarativeContent {
EventStream<void> get onPageChanged =>
$js.chrome.declarativeContent.onPageChanged.asStream(($c) => () {
return $c(null);
});
}.toJS);
}

enum PageStateMatcherInstanceType {
Expand Down
2 changes: 1 addition & 1 deletion lib/declarative_net_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class ChromeDeclarativeNetRequest {
$js.chrome.declarativeNetRequest.onRuleMatchedDebug
.asStream(($c) => ($js.MatchedRuleInfoDebug info) {
return $c(MatchedRuleInfoDebug.fromJS(info));
});
}.toJS);
}

/// This describes the resource type of the network request.
Expand Down
4 changes: 2 additions & 2 deletions lib/devtools_inspected_window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ChromeDevtoolsInspectedWindow {
$js.chrome.devtools.inspectedWindow.onResourceAdded
.asStream(($c) => ($js.Resource resource) {
return $c(Resource.fromJS(resource));
});
}.toJS);

/// Fired when a new revision of the resource is committed (e.g. user saves an
/// edited version of the resource in the Developer Tools).
Expand All @@ -105,7 +105,7 @@ class ChromeDevtoolsInspectedWindow {
resource: Resource.fromJS(resource),
content: content,
));
});
}.toJS);
}

class Resource {
Expand Down
4 changes: 2 additions & 2 deletions lib/devtools_network.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class ChromeDevtoolsNetwork {
$js.chrome.devtools.network.onRequestFinished
.asStream(($c) => ($js.Request request) {
return $c(Request.fromJS(request));
});
}.toJS);

/// Fired when the inspected window navigates to a new page.
EventStream<String> get onNavigated =>
$js.chrome.devtools.network.onNavigated.asStream(($c) => (String url) {
return $c(url);
});
}.toJS);
}

class Request {
Expand Down
16 changes: 8 additions & 8 deletions lib/devtools_panels.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class ElementsPanel {
EventStream<void> get onSelectionChanged =>
_wrapped.onSelectionChanged.asStream(($c) => () {
return $c(null);
});
}.toJS);
}

class SourcesPanel {
Expand Down Expand Up @@ -156,7 +156,7 @@ class SourcesPanel {
EventStream<void> get onSelectionChanged =>
_wrapped.onSelectionChanged.asStream(($c) => () {
return $c(null);
});
}.toJS);
}

class ExtensionPanel {
Expand Down Expand Up @@ -199,18 +199,18 @@ class ExtensionPanel {
action: action,
queryString: queryString,
));
});
}.toJS);

/// Fired when the user switches to the panel.
EventStream<JSObject> get onShown =>
_wrapped.onShown.asStream(($c) => (JSObject window) {
return $c(window);
});
}.toJS);

/// Fired when the user switches away from the panel.
EventStream<void> get onHidden => _wrapped.onHidden.asStream(($c) => () {
return $c(null);
});
}.toJS);
}

class ExtensionSidebarPane {
Expand Down Expand Up @@ -277,13 +277,13 @@ class ExtensionSidebarPane {
EventStream<JSObject> get onShown =>
_wrapped.onShown.asStream(($c) => (JSObject window) {
return $c(window);
});
}.toJS);

/// Fired when the sidebar pane becomes hidden as a result of the user
/// switching away from the panel that hosts the sidebar pane.
EventStream<void> get onHidden => _wrapped.onHidden.asStream(($c) => () {
return $c(null);
});
}.toJS);
}

class Button {
Expand Down Expand Up @@ -316,7 +316,7 @@ class Button {
/// Fired when the button is clicked.
EventStream<void> get onClicked => _wrapped.onClicked.asStream(($c) => () {
return $c(null);
});
}.toJS);
}

class ExtensionPanelOnSearchEvent {
Expand Down
4 changes: 2 additions & 2 deletions lib/devtools_recorder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ class RecorderView {
/// Fired when the view is shown.
EventStream<void> get onShown => _wrapped.onShown.asStream(($c) => () {
return $c(null);
});
}.toJS);

/// Fired when the view is hidden.
EventStream<void> get onHidden => _wrapped.onHidden.asStream(($c) => () {
return $c(null);
});
}.toJS);
}
8 changes: 4 additions & 4 deletions lib/downloads.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class ChromeDownloads {
EventStream<DownloadItem> get onCreated => $js.chrome.downloads.onCreated
.asStream(($c) => ($js.DownloadItem downloadItem) {
return $c(DownloadItem.fromJS(downloadItem));
});
}.toJS);

/// Fires with the `downloadId` when a download is erased from
/// history.
Expand All @@ -194,7 +194,7 @@ class ChromeDownloads {
EventStream<int> get onErased =>
$js.chrome.downloads.onErased.asStream(($c) => (int downloadId) {
return $c(downloadId);
});
}.toJS);

/// When any of a [DownloadItem]'s properties except
/// `bytesReceived` and `estimatedEndTime` changes,
Expand All @@ -203,7 +203,7 @@ class ChromeDownloads {
EventStream<DownloadDelta> get onChanged => $js.chrome.downloads.onChanged
.asStream(($c) => ($js.DownloadDelta downloadDelta) {
return $c(DownloadDelta.fromJS(downloadDelta));
});
}.toJS);

/// During the filename determination process, extensions will be given the
/// opportunity to override the target [DownloadItem.filename]. Each
Expand Down Expand Up @@ -238,7 +238,7 @@ class ChromeDownloads {
(suggest as Function)(suggestion?.toJS);
},
));
});
}.toJS);
}

/// <dl><dt>uniquify</dt>
Expand Down
Loading

0 comments on commit 244c101

Please sign in to comment.