A collection of Dart code samples by Dart DevRel

Overview

Dart samples

CI

A collection of Dart programs that illustrate features and best practices. For a list of community-maintained projects, see Awesome Dart.

Index

  • command_line - A command line app that parses command-line options and fetches from GitHub.
  • extension_methods - A set of samples that demonstrates the extension methods syntax and shows some common use cases of the feature.
  • null_safety/calculate_lix - A sample app that calculates the 'lix' readability index with an implementation that uses the tech preview of Dart's new null safety feature.
  • ffi - A series of simple examples demonstrating how to call C libraries from Dart.
  • isolates - Command line applications that demonstrate how to work with Concurrency in Dart using isolates. The examples read and parse JSON content in a worker isolate, and return the result to the main isolate.
  • native_app - A command line application that can be compiled to native code using dart2native.
  • server - Examples of running Dart on the server.

More samples

Contributing

See the Contributing guide for details on how to contribute.

Comments
  • Adopting to the new style of typedef in dart and code re-structring

    Adopting to the new style of typedef in dart and code re-structring

    As docs refers

    There is an old and new way of typedef

    in general: the new way is a bit clearer and more readable.

    in details:

    typedef G = List<int> Function(int); // New form.
    typedef List<int> H(int i); // Old form.
    

    Note that the name of the parameter is required in the old form, but the type may be omitted. In contrast, the type is required in the new form, but the name may be omitted.

    As well as

    The reason for having two ways to express the same thing is that the new form seamlessly covers non-generic functions as well as generic ones, and developers might prefer to use the new form everywhere, for improved readability.

    So the applied changes were, to adopt to this new way of writing typedef, as well as, minor changes for code re-structuring were applied, where four functions were created to work as standalone unit of code

    opened by Abdulrahman-Falyoun 12
  • Error when ffi: ^0.1.2

    Error when ffi: ^0.1.2

    Error: Expected 0 type arguments.
    class Utf8 extends Struct<Utf8> {
                       ^
    Error: Expected 0 type arguments.
    class Utf16 extends Struct<Utf16> {
                        ^
    Error: Type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart'.
     - 'NativeType' is from 'dart:ffi'.
    Try changing type arguments so that they conform to the bounds.
      static int strlen(Pointer<Utf8> string) {
                                      ^
    Error: Type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart'.
     - 'NativeType' is from 'dart:ffi'.
    Try changing type arguments so that they conform to the bounds.
      static String fromUtf8(Pointer<Utf8> string) {
                                           ^
    Error: Type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer' in the return type.
     - 'Utf8' is from 'package:ffi/src/utf8.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try changing type arguments so that they conform to the bounds.
      static Pointer<Utf8> toUtf8(String string) {
                                 ^
     Error: Type argument 'Utf16' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer' in the return type.
     - 'Utf16' is from 'package:ffi/src/utf16.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try changing type arguments so that they conform to the bounds.
      static Pointer<Utf16> toUtf16(String s) {
                                   ^
    Error: Type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try changing type arguments so that they conform to the bounds.
      final systemP = dylib.lookupFunction<SystemC, SystemDart>('system');
                            ^
    Error: Inferred type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart'.
     - 'NativeType' is from 'dart:ffi'.
    Try specifying type arguments explicitly so that they conform to the bounds.
      final systemP = dylib.lookupFunction<SystemC, SystemDart>('system');
            ^
    Error: Inferred type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try specifying type arguments explicitly so that they conform to the bounds.
      final cmdP = Utf8.toUtf8(command);
            ^
    Error: Type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try changing type arguments so that they conform to the bounds.
      final systemP = dylib.lookupFunction<SystemC, SystemDart>('system');
                            ^
    Error: Inferred type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try specifying type arguments explicitly so that they conform to the bounds.
      final systemP = dylib.lookupFunction<SystemC, SystemDart>('system');
            ^
    Error: Inferred type argument 'Utf8' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try specifying type arguments explicitly so that they conform to the bounds.
      final cmdP = Utf8.toUtf8(command);
            ^
    Error: Inferred type argument 'Utf16' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf16' is from 'package:ffi/src/utf16.dart' .
     - 'NativeType' is from 'dart:ffi'.
    Try specifying type arguments explicitly so that they conform to the bounds.
      final operationP = Utf16.toUtf16(operation);
            ^
    Error: Inferred type argument 'Utf16' doesn't conform to the bound 'NativeType' of the type variable 'T' on 'Pointer'.
     - 'Utf16' is from 'package:ffi/src/utf16.dart'.
     - 'NativeType' is from 'dart:ffi'.
    Try specifying type arguments explicitly so that they conform to the bounds.
      final fileP = Utf16.toUtf16(file);
            ^
    Error: The argument type 'Pointer<Utf16>' can't be assigned to the parameter type 'Pointer<NativeType>'.
     - 'Pointer' is from 'dart:ffi'.
     - 'Utf16' is from 'package:ffi/src/utf16.dart' .
     - 'NativeType' is from 'dart:ffi'.
          ffi.nullptr, operationP, fileP, ffi.nullptr, ffi.nullptr, SW_SHOWNORMAL);
                       ^
    Error: The argument type 'Pointer<Utf16>' can't be assigned to the parameter type 'Pointer<NativeType>'.
     - 'Pointer' is from 'dart:ffi'.
     - 'Utf16' is from 'package:ffi/src/utf16.dart'.
     - 'NativeType' is from 'dart:ffi'.
          ffi.nullptr, operationP, fileP, ffi.nullptr, ffi.nullptr, SW_SHOWNORMAL);
                                   ^
    Error: The method 'asExternalTypedData' isn't defined for the class 'Pointer<Uint8>'.
     - 'Pointer' is from 'dart:ffi'.
     - 'Uint8' is from 'dart:ffi'.
    Try correcting the name to the name of an existing method, or defining a method named 'asExternalTypedData'.
        final Uint8List nativeString = array.asExternalTypedData(count: _maxSize);
                                             ^^^^^^^^^^^^^^^^^^^
    Error: The method 'asExternalTypedData' isn't defined for the class 'Pointer<Uint8>'.
     - 'Pointer' is from 'dart:ffi'.
     - 'Uint8' is from 'dart:ffi'.
    Try correcting the name to the name of an existing method, or defining a method named 'asExternalTypedData'.
            string.cast<Uint8>().asExternalTypedData(count: length).buffer,
                                 ^^^^^^^^^^^^^^^^^^^
    Error: Method not found: 'Pointer.allocate'.
            Pointer<Uint8>.allocate(count: units.length + 1);
                           ^^^^^^^^
    Error: The method 'asExternalTypedData' isn't defined for the class 'Pointer<Uint8>'.
     - 'Pointer' is from 'dart:ffi'.
     - 'Uint8' is from 'dart:ffi'.
    Try correcting the name to the name of an existing method, or defining a method named 'asExternalTypedData'.
            result.asExternalTypedData(count: units.length + 1);
                   ^^^^^^^^^^^^^^^^^^^
    Error: The getter 'addressOf' isn't defined for the class 'Utf8'.
     - 'Utf8' is from 'package:ffi/src/utf8.dart' .
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'addressOf'.
      String toString() => fromUtf8(addressOf);
                                    ^^^^^^^^^
    Error: Method not found: 'Pointer.allocate'.
            Pointer<Uint16>.allocate(count: units.length + 1);
                            ^^^^^^^^
    Error: The method 'asExternalTypedData' isn't defined for the class 'Pointer<Uint16>'.
     - 'Pointer' is from 'dart:ffi'.
     - 'Uint16' is from 'dart:ffi'.
    Try correcting the name to the name of an existing method, or defining a method named 'asExternalTypedData'.
            result.asExternalTypedData(count: units.length + 1);
                   ^^^^^^^^^^^^^^^^^^^
    Exception: Errors during snapshot creation: null
    #0      KernelSnapshot.build (package:flutter_tools/src/build_system/targets/dart.dart:230:7)
    <asynchronous suspension>
    #1      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:526:25)
    <asynchronous suspension>
    #2      _BuildInstance.invokeTarget.<anonymous closure> (package:flutter_tools/src/build_system/build_system.dart:481:35)
    #3      new Future.sync (dart:async/future.dart:222:31)
    #4      AsyncMemoizer.runOnce (package:async/src/async_memoizer.dart:43:45)
    #5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:481:21)
    <asynchronous suspension>
    <asynchronous suspension>
    #6      BuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:419:36)
    #7      _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
    #8      BuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:400:28)
    #9      buildWithAssemble (package:flutter_tools/src/bundle.dart:125:48)
    #10     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
    #11     buildWithAssemble (package:flutter_tools/src/bundle.dart:99:31)
    #12     BundleBuilder.build (package:flutter_tools/src/bundle.dart:75:11)
    #13     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
    #14     BundleBuilder.build (package:flutter_tools/src/bundle.dart:52:21)
    #15     BuildBundleCommand.runCommand (package:flutter_tools/src/commands/build_bundle.dart:126:25)
    #16     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
    #17     BuildBundleCommand.runCommand (package:flutter_tools/src/commands/build_bundle.dart:97:42)
    #18     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:557:18)
    #19     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
    #20     _rootRunUnary (dart:async/zone.dart:1132:38)
    #21     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
    #22     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
    #23     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
    #24     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
    #25     Future._completeWithValue (dart:async/future_impl.dart:522:5)
    #26     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
    #27     _rootRun (dart:async/zone.dart:1124:13)
    #28     _CustomZone.run (dart:async/zone.dart:1021:19)
    #29     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
    #30     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
    #31     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #32     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    #33     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
    #34     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
    

    flutter doctor

    [✓] Flutter (Channel master, v1.10.15-pre.307, on Mac OS X 10.15.1 19B88)
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    [!] Xcode - develop for iOS and macOS (Xcode 11.1)
        ✗ CocoaPods installed but not working.
            You appear to have CocoaPods installed but it is not working.
            This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
            This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
          To re-install CocoaPods, run:
            sudo gem install cocoapods
    [✓] Chrome - develop for the web
    [!] Android Studio (version 3.5)
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
    [✓] IntelliJ IDEA Community Edition (version 2019.2.3)
    [✓] VS Code (version 1.39.2)
    [✓] Connected device (3 available)
    
    ! Doctor found issues in 2 categories.
    
    opened by crazecoder 12
  • Create dart.yml

    Create dart.yml

    Created per @kevmoo's request in https://github.com/dart-lang/samples/pull/81#issuecomment-756531146

    Hey @RedBrogdon and @johnpryan,

    I started porting the travis test set to Github Actions and I hit something of a head scratcher. I realised that our Travis tests purport to run tests on windows... using a shell script runner. Which makes almost no sense. Unless the Travis windows machines have cygwin or similar installed.

    Note, the windows tests appear to pass, even though some of the tests are specifically written for linux only (and test for the presence of a generated .so file ... as opposed to the .dll or .dylib that should be created on Windows and macOS respectively.

    opened by domesticmouse 10
  • Internal error when running macos.dart

    Internal error when running macos.dart

    When attempting to run the unmodified sample at https://github.com/dart-lang/samples/blob/master/ffi/system-command/macos.dart I get the following error:

    ➜  dart_ffi: $ dart macos.dart
    Crash when compiling file:///Users/thinkdigital/github/dart_ffi/macos.dart,
    at character offset 62893:
    macos.dart:854:240: Internal problem: Unhandled ParserRecovery in handleType.
            <td id="LC21" class="blob-code blob-code-inner js-file-line"><span class="pl-k">typedef</span> <span class="pl-c1">SystemC</span> <span class="pl-k">=</span> ffi.<span class="pl-c1">Int32</span> <span class="pl-c1">Function</span>(ffi.<span class="pl-c1">Pointer</span><span class="pl-k">&lt;</span><span class="pl-c1">Utf8</span><span class="pl-k">&gt;</span> command);</td>
                                                                                                                                                                                                                                                   ^
    #0      internalProblem (package:front_end/src/fasta/problems.dart:45:3)
    #1      unhandled (package:front_end/src/fasta/problems.dart:58:10)
    #2      BodyBuilder.handleType (package:front_end/src/fasta/kernel/body_builder.dart:2800:7)
    #3      ComplexTypeInfo.parseType (package:front_end/src/fasta/parser/type_info_impl.dart:504:25)
    #4      Parser.parseFormalParameter (package:front_end/src/fasta/parser/parser.dart:1478:24)
    #5      Parser.parseFormalParametersRest (package:front_end/src/fasta/parser/parser.dart:1252:15)
    #6      Parser.parseFormalParameters (package:front_end/src/fasta/parser/parser.dart:1216:12)
    #7      Parser.parseFormalParametersOpt (package:front_end/src/fasta/parser/parser.dart:1176:15)
    #8      DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:885:22)
    
    using Dart version 2.6:
    
    > [✓] Flutter (Channel master, v1.10.3-pre.65, on Mac OS X 10.14.6 18G95, locale en-US)
    >     • Flutter version 1.10.3-pre.65 at /Users/thinkdigital/development/flutter
    >     • Framework revision 0df1594ba2 (28 minutes ago), 2019-09-16 15:27:05 -0700
    >     • Engine revision 63873d9f42
    >     • Dart version 2.6.0 (build 2.6.0-dev.0.0 7799f424f4)
    opened by ThinkDigitalSoftware 9
  • FFI synchronous callback samples

    FFI synchronous callback samples

    And how to create function pointer?

    typedef Pointer GlfwSetKeyCallback(Pointer<GLFWWindow> window, Pointer callback);
    glfwSetKeyCallback(_window, dartFunction);```
    FFI 
    opened by ykmnkmi 8
  • Add FFI callback sample

    Add FFI callback sample

    This is an example of passing a callback method from Dart to C and having that callback method called synchronously. The program is deliberately simple, to not obfuscate exactly what is required to do this one simple thing.

    This is our first PR. We're quite willing to accept any fix requests should the code not be as needed.

    FFI 
    opened by mschwartz 7
  • Update Makefile for windows

    Update Makefile for windows

    Updated all the Makefiles to run dart:ffi examples on a Windows machine.

    Use make dll on windows.

    Which currently creates hello_world.dylib (minimal code changes) instead of hello_world.dll which should be the standard name.

    Also, removed annotations in structs/structs.dart

    image

    opened by phanirithvij 7
  • Add more places to try and learn NNBD, and an example for per-file NNBD

    Add more places to try and learn NNBD, and an example for per-file NNBD

    There is one place I expect static analysis to pick it up, but instead it's a runtime error. It's in the switch case in https://github.com/dart-lang/samples/pull/69/commits/4859de40719de60f32c4153095ebdfc5e677b22c#diff-9e0b069eeab563d6a82928ebc03a01c5R39 , compiled with Dart VM version: 2.9.0-14.1.beta (beta) (Tue Jun 9 10:52:57 2020 +0200) on "macos_x64"

    opened by truongsinh 6
  • primitive FFI sample broken on macOS due to import problem

    primitive FFI sample broken on macOS due to import problem

    Problem

    On macOS, running the primitive sample code after proper CMaking the C lib gives the following error

    $ !dart
    dart primitives.dart
    Unhandled exception:
    Invalid argument(s): Failed to load dynamic library (dlopen(./primitives_library/libprimtives.dylib, 1): image not found)
    #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:10:55)
    #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:19:12)
    #2      main (file:///Users/kakyo/Desktop/_task/MMT/research/hello-mamguest/hello_dart/primitives/primitives.dart:41:32)
    #3      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:19)
    #4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
    

    Fix

    $ sdiff -l theirs/ffi/primitives/primitives.dart mine/primitives/primitives.dart | cat -n | grep -v -e '($'
    5	import 'dart:ffi';					      |	import 'dart:ffi' as ffi;
    41	  final dylib = DynamicLibrary.open(path);		      |	  final dylib = ffi.DynamicLibrary.open(path);
    
    opened by kakyoism 6
  • WINDOWS/WIN32 API Problem allocating/reading UTF16

    WINDOWS/WIN32 API Problem allocating/reading UTF16

    I have this code I can't get it to work, no errors are shown

    import 'dart:ffi';
    
    import 'package:ffi/ffi.dart';
    
    class HWND extends Struct {}
    
    typedef GetActiveWindowC = Pointer<HWND> Function();
    
    typedef GetActiveWindowDart = Pointer<HWND> Function();
    
    typedef GetWindowTextC = Int32 Function(Pointer<HWND> hWnd, Pointer<Utf8> lpString, Int32 nMaxCount);
    
    typedef GetWindowTextDart = int Function(Pointer<HWND> hWnd, Pointer<Utf8> lpString, int nMaxCount);
    
    void main() {
      var path = r'User32.dll';
      final dylib = DynamicLibrary.open(path);
    
      final GetActiveWindowPointer =
          dylib.lookup<NativeFunction<GetActiveWindowC>>('GetActiveWindow');
      final GetActiveWindowDart GetActiveWindow =
          GetActiveWindowPointer.asFunction<GetActiveWindowDart>();
    
      final GetWindowTextPointer =
          dylib.lookup<NativeFunction<GetWindowTextC>>('GetWindowTextA');
      final GetWindowTextDart GetWindowText =
          GetWindowTextPointer.asFunction<GetWindowTextDart>();
    
      final Pointer<HWND> hWnd = GetActiveWindow();
    
      final Pointer<Utf8> lpString = allocate();
    
      final int nMaxCount = 256;
    
      final result = GetWindowText(hWnd, lpString, nMaxCount);
    
      final text = Utf8.fromUtf8(lpString);
    
      print(result);
      print(text);
    }
    

    current output:

    0
    
    
    opened by vieruuuu 6
  • Dart FFI docs don't work for Linux

    Dart FFI docs don't work for Linux

    Dart VM version: 2.6.0-dev.0.0 (Tue Sep 10 12:55:30 2019 +0200) on "linux_x64" Ubuntu 16.04

    The documentation at

    https://dart.dev/guides/libraries/c-interop

    is, as it claims to be, MacOS-specific. Building hello_world on Linux involves changing the Makefile. Here's one that works:

    hello: hello.c hello.h 
            gcc -o a.out hello.c 
     
    dylib: hello.c hello.h 
            gcc -c -fPIC hello.c -o hello.o 
            gcc -shared hello.o -o ../hello_world.dylib 
    

    Just thought it ought to be added.

    opened by lcrocker 6
  • Bump actions/cache from 3.0.11 to 3.2.2

    Bump actions/cache from 3.0.11 to 3.2.2

    Bumps actions/cache from 3.0.11 to 3.2.2.

    Release notes

    Sourced from actions/cache's releases.

    v3.2.2

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/cache/compare/v3.2.1...v3.2.2

    v3.2.1

    What's Changed

    Full Changelog: https://github.com/actions/cache/compare/v3.2.0...v3.2.1

    v3.2.0

    What's Changed

    New Contributors

    ... (truncated)

    Changelog

    Sourced from actions/cache's changelog.

    Releases

    3.0.0

    • Updated minimum runner version support from node 12 -> node 16

    3.0.1

    • Added support for caching from GHES 3.5.
    • Fixed download issue for files > 2GB during restore.

    3.0.2

    • Added support for dynamic cache size cap on GHES.

    3.0.3

    • Fixed avoiding empty cache save when no files are available for caching. (issue)

    3.0.4

    • Fixed tar creation error while trying to create tar with path as ~/ home folder on ubuntu-latest. (issue)

    3.0.5

    • Removed error handling by consuming actions/cache 3.0 toolkit, Now cache server error handling will be done by toolkit. (PR)

    3.0.6

    • Fixed #809 - zstd -d: no such file or directory error
    • Fixed #833 - cache doesn't work with github workspace directory

    3.0.7

    • Fixed #810 - download stuck issue. A new timeout is introduced in the download process to abort the download if it gets stuck and doesn't finish within an hour.

    3.0.8

    • Fix zstd not working for windows on gnu tar in issues #888 and #891.
    • Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable SEGMENT_DOWNLOAD_TIMEOUT_MINS. Default is 60 minutes.

    3.0.9

    • Enhanced the warning message for cache unavailablity in case of GHES.

    3.0.10

    • Fix a bug with sorting inputs.
    • Update definition for restore-keys in README.md

    3.0.11

    • Update toolkit version to 3.0.5 to include @actions/core@^1.10.0
    • Update @actions/cache to use updated saveState and setOutput functions from @actions/core@^1.10.0

    3.1.0-beta.1

    • Update @actions/cache on windows to use gnu tar and zstd by default and fallback to bsdtar and zstd if gnu tar is not available. (issue)

    3.1.0-beta.2

    • Added support for fallback to gzip to restore old caches on windows.

    3.1.0-beta.3

    ... (truncated)

    Commits
    • 4723a57 Revert compression changes related to windows but keep version logging (#1049)
    • d1507cc Merge pull request #1042 from me-and/correct-readme-re-windows
    • 3337563 Merge branch 'main' into correct-readme-re-windows
    • 60c7666 save/README.md: Fix typo in example (#1040)
    • b053f2b Fix formatting error in restore/README.md (#1044)
    • 501277c README.md: remove outdated Windows cache tip link
    • c1a5de8 Upgrade codeql to v2 (#1023)
    • 9b0be58 Release compression related changes for windows (#1039)
    • c17f4bf GA for granular cache (#1035)
    • ac25611 docs: fix an invalid link in workarounds.md (#929)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump actions/checkout from 3.1.0 to 3.2.0

    Bump actions/checkout from 3.1.0 to 3.2.0

    Bumps actions/checkout from 3.1.0 to 3.2.0.

    Release notes

    Sourced from actions/checkout's releases.

    v3.2.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/checkout/compare/v3...v3.2.0

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • FFI structs sample possible dangling pointer

    FFI structs sample possible dangling pointer

    Please ignore my ignorance but while I'm trying to learn more about ffi I studied the structs sample.

    I just don't understand how freeing myHomeUtf8 does not leave a dangling pointer in the the native Place struct.

    https://github.com/dart-lang/samples/blob/master/ffi/structs/structs_library/structs.c#L58

      struct Place create_place(char *name, double latitude, double longitude)
      {
        struct Place place;
        place.name = name;
        // ...
    

    https://github.com/dart-lang/samples/blob/master/ffi/structs/structs.dart#L94

      final myHomeUtf8 = 'My Home'.toNativeUtf8();
      final createPlace =
          dylib.lookupFunction<CreatePlaceNative, CreatePlace>('create_place');
      final place = createPlace(myHomeUtf8, 42.0, 24.0);
      calloc.free(myHomeUtf8);
      final name = place.name.toDartString();
    

    I understand that someone needs to free that memory and that in a sample memory management might not be the biggest concern. But accessing the name after freeing the memory seems especially odd to me.

    Most likely I'm just missing something here.

    FFI 
    opened by doubleday 3
  • FFI C finalizers

    FFI C finalizers

    We should consider adding a sample with finalizers.

    More info in the first post in https://github.com/dart-lang/sdk/issues/35770.

    There are a ton of questions around using the C API for finalizers, so having a sample would be a good thing.

    enhancement FFI 
    opened by dcharkes 0
  • FFI asynchronous callback samples

    FFI asynchronous callback samples

    We might want to add a sample for asynchronous callbacks to this repo. This requires compiling against dart_api(_dl).h.

    See the samples in the SDK repo:

    • Dart code: https://github.com/dart-lang/sdk/tree/master/samples/ffi/async
    • C code: https://github.com/dart-lang/sdk/blob/master/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc

    Context: https://github.com/dart-lang/sdk/issues/46135

    enhancement FFI 
    opened by dcharkes 0
  • Add Windows CMake instructions

    Add Windows CMake instructions

    Hi, I try to run the example as is and after running cmake command running the command make and getting error: make: *** No targets specified and no makefile found

    FFI 
    opened by fedorovmichael 5
Owner
Dart
Dart is an open-source, scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps.
Dart
Learn Flutter on Flutter! A widget directory with implementation samples!

Fludget Browse through a variety of widgets used in flutter This application is developed to learn Flutter using Flutter. Different widgets used in fl

ACM VIT 29 Nov 23, 2022
A collection of packages created to increase code reuse across many of my Flutter projects.

CodeWithAndrea Flutter Packages A collection of packages, created to increase code reuse across many of my Flutter projects. They include: Wrappers fo

Andrea Bizzotto 111 Dec 29, 2022
A collection of helpful utilities for use in Dart projects.

w_common A collection of helpful utilities for use in Dart projects. Right now, it includes the following: Disposable interface / mixin to assist with

Workiva 10 Dec 16, 2022
A collection of Flutter examples and demos.

Flutter samples A collection of open source samples that illustrate best practices for Flutter. Visual samples index The easiest way to browse through

Flutter 14.1k Jan 7, 2023
Movie Lib is a mobile application where you can find the movies of your interest. This app provides a collection of movies of different languages according to your interest.

Movie Lib Movie Lib is a mobile application where you can find the movies of your interest. This app provides a collection of movies of different lang

Abhijith Kp 6 Sep 28, 2021
A collection of simple, bare-bones Flutter apps that each demonstrate a concept

flutter-by-example A collection of simple, bare-bones Flutter apps that each demonstrate a concept The apps are slowly being updated to Dart 2; be sur

Matt Sullivan 1k Dec 10, 2022
🔥 A collection of Firebase plugins for Flutter apps.

FlutterFire FlutterFire is a set of Flutter plugins that enable Flutter apps to use Firebase services. You can follow an example that shows how to use

null 7.4k Dec 31, 2022
Collection of common localization assets for Nations package

Nations Assets ?? collection of common localization assets for Nations package. FAQ Why not with Nations ? to make the Nations smaller and give the us

FlutterQueen 2 Jun 22, 2022
A flutter package which contains a collection of Splash Screen example for your app to display logo and different text style.

splash_screen_view They say, first impression is the last! Yep, truly for any amazingly crafted application, it's easier to start impressing your audi

Sandip Kalola (SK) 17 Nov 25, 2022
A discord bot, made with Dart, which lets you run your own pure Dart code snippets directly via a discord ping, and get the output in an instant.

A discord bot, made with Dart, which lets you run your own pure Dart code snippets directly via a discord ping, and get the output in an instant.

Anikate De 3 Oct 21, 2022
A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

Iiro Krankka 3.4k Dec 30, 2022
Utilities for loading and running WASM modules from Dart code

Provides utilities for loading and running WASM modules Built on top of the Wasmer runtime. Setup Run dart run wasm:setup to build the Wasmer runtime.

Dart 284 Dec 23, 2022
Allows Dart reflection using code generation/builder.

reflection_factory reflection_factory allows Dart reflection with an easy approach, even for third-party classes, using code generation portable for a

Graciliano Monteiro Passos 13 Oct 30, 2022
UI design for mobile, create using visual studio code & flutter dart programming languange

HCIProjectLab A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

null 1 Oct 13, 2021
Routinger is a task scheduler app that is made to make you a better person at no extra cost. The code is open-source. Dart language and Flutter framework are used extensively.

Routinger This is a simple app that will allow you to schedule your tasks, create a simple to-do, and also make recurring tasks. The app ends you noti

Routinger 16 Dec 17, 2022
Dart GraphQL server implementation. Utilities, code generator, examples and reference implementation.

Leto - GraphQL Server A complete implementation of the official GraphQL specification in the Dart programming language. Inspired by graphql-js, async-

Juan Manuel Castillo 29 Nov 27, 2022
Naj - An open-source code generation and file management system written in Dart

Naj An open-source code generation and file management system written in Dart Ov

Najibullah Khoda Rahim 1 Feb 14, 2022
Berikut merupakan source code Chat Apps dengan Flutter + GetX + Firebase

chatapp A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Sandikha Rahardi 52 Dec 31, 2022
Source code for @flutter.master

Flutter-Master Reels Onboarding screen Go Personal Finance Go Nike Store Go Travel App Go Solar system App Go Animations Implicit animations Go Tween

null 28 Nov 16, 2022