Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Lower SDK lower bound to 3.0.0 #5

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ permissions: read-all

jobs:
analyze:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
sdk: [dev, stable]

steps:
# These are the latest versions of the github actions; dependabot will
# send PRs to keep these up-to-date.
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: dev
sdk: ${{ matrix.sdk }}

- name: Install dependencies
run: dart pub get
Expand All @@ -39,7 +43,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [dev]
sdk: [dev, stable]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.0

- Lower SDK lower bound to 3.0.0.

## 0.1.0

- Initial version.
Expand Down
21 changes: 16 additions & 5 deletions lib/mailbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,22 @@ class Mailbox {
static final _emptyResponse = Uint8List(0);

static Uint8List _toList(Pointer<Uint8> buffer, int length) {
return length == 0
? _emptyResponse
// We have to ignore sdk_version_since warning due to dartbug.com/53142.
// ignore: sdk_version_since
: buffer.asTypedList(length, finalizer: malloc.nativeFree);
if (length == 0) {
return _emptyResponse;
}

// TODO: remove feature detection once 3.1 becomes stable.
// ignore: omit_local_variable_types
final Uint8List Function(int) asTypedList = buffer.asTypedList;
if (asTypedList is Uint8List Function(int,
{Pointer<NativeFinalizerFunction> finalizer})) {
return asTypedList(length, finalizer: malloc.nativeFree);
}

final result = Uint8List(length);
result.setRange(0, length, buffer.asTypedList(length));
malloc.free(buffer);
return result;
}

static Pointer<Uint8> _toBuffer(Uint8List list) {
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: native_synchronization
description: Low level synchronization primitives built on dart:ffi.
version: 0.1.0
version: 0.2.0
repository: https://github.com/dart-lang/native_synchronization

environment:
sdk: ">=3.1.0-348.0.dev <4.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
ffi: ^2.1.0
Expand Down