mac 2.0.0

  • README.md
  • Installing
  • Versions
  • 0

macOS for Dart

Dart package for macOS integration.

Features

  • Easy to use
  • Dictation (Speech Recognition and TTS)
  • Application Interaction (High Level API for working with applications)
  • Scripting Helpers
  • System Information
  • User Interface

Example

import "package:mac/mac.dart";

void main() {
  say("Your computer is named: ${SystemInformation.getComputerName()}");
  say("You are running macOS ${SystemInformation.getVersion()}");
  say("Battery is at ${Battery.getLevel()}%");
  say("There are ${Applications.list().length} apps installed");

  if (Finder.getWindowCount() == 0) {
    say("Finder is not open.");
  } else {
    say("Finder is open.");
  }

  var app = Applications.get("Textual 5");

  if (app.isInstalled()) {
    say("Textual 5 is installed");
  } else {
    say("Textual 5 is not installed.");
  }

  var result = UI.displayDialog("Open Mission Control?", buttons: [
    "Yes",
    "No"
  ]);

  if (result.button == "Yes") {
    say("Opening Mission Control");
    MissionControl.activate();
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mac: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mac/mac.dart';
  
Version Uploaded Documentation Archive
2.0.0 Aug 20, 2016 Go to the documentation of mac 2.0.0 Download mac 2.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.1.0.
 
 Because mac depends on jsonx >=1.0.1 which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format lib/record_parser.dart.

Run dartfmt to format lib/record_parser.dart.

Format lib/src/apps.dart.

Run dartfmt to format lib/src/apps.dart.

Format lib/src/common.dart.

Run dartfmt to format lib/src/common.dart.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/dictation.dart (Run dartfmt to format lib/src/dictation.dart.)
  • lib/src/plist.dart (Run dartfmt to format lib/src/plist.dart.)
  • lib/src/script.dart (Run dartfmt to format lib/src/script.dart.)
  • lib/src/ui.dart (Run dartfmt to format lib/src/ui.dart.)
  • lib/src/utils/time.dart (Run dartfmt to format lib/src/utils/time.dart.)
  • lib/src/where_am_i.dart (Run dartfmt to format lib/src/where_am_i.dart.)

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Package is too old. (-100 points)

The package was released more than two years ago.

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use mac.dart. Packages with multiple examples should use example/readme.md.