mac 2.0.0

  • README.md
  • Installing
  • Versions
  • 30

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]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
30
Learn more about scoring.

We analyzed this package on Aug 16, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

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

Fix platform conflicts.

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Maintain CHANGELOG.md.

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

Add SDK constraint in pubspec.yaml.

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

Package is getting outdated.

The package was released 103 weeks ago.

The description is too short.

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

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.

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.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/common.dart (Run dartfmt to format lib/src/common.dart.)
  • 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.)