doomemacs/modules/lang/dart/README.org

119 lines
4.7 KiB
Org Mode
Raw Normal View History

2020-02-17 10:12:23 -05:00
#+TITLE: lang/dart
#+DATE: February 16, 2020
#+SINCE: v3.0.0
2020-02-17 10:12:23 -05:00
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#installing-dart-sdk][Installing Dart SDK]]
- [[#installing-flutter-sdk][Installing Flutter SDK]]
2020-02-17 10:12:23 -05:00
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#dart--flutter][Dart & Flutter]]
- [[#android][Android]]
2020-07-23 15:36:01 -03:00
- [[#flutter-mobile-development-on-desktop][Flutter mobile development on desktop]]
2020-02-17 10:12:23 -05:00
- [[#troubleshooting][Troubleshooting]]
* Description
[[https://dart.dev/][Dart]] is a client-optimized language by Google for fast apps on any platform.
2020-07-23 15:36:01 -03:00
It is fast and optimized for UI, famous for the [[https://flutter.io/][Flutter]] framework, also
made by Google. Both Flutter and Dart are free and open-source.
2020-02-17 10:12:23 -05:00
2020-07-23 15:36:01 -03:00
This module wraps ~dart-mode~, with [[https://microsoft.github.io/language-server-protocol/][LSP]] features like code completion for =.dart= files,
syntax highlighting, debugging, closing labels, etc.
2020-03-27 18:06:31 -04:00
2020-02-17 10:12:23 -05:00
** Maintainers
2020-07-23 15:36:01 -03:00
+ [[https://github.com/ericdallo][@ericdallo]]
2020-02-17 10:12:23 -05:00
** Module Flags
2020-03-27 18:06:31 -04:00
+ =+lsp= Enable LSP server integration.
+ =+flutter= Adds ~flutter~ integration and some sane defaults for Flutter
development along with ~hover~ for desktop development.
2020-02-17 10:12:23 -05:00
** Plugins
+ [[https://github.com/bradyt/dart-mode][dart-mode]]
+ [[https://github.com/amake/flutter.el][flutter.el]]
+ [[https://github.com/ericdallo/hover.el][hover.el]]
2020-02-17 10:12:23 -05:00
* Prerequisites
2020-03-27 18:06:31 -04:00
Make sure that the Dart SDK is on your ~PATH~, and if using Flutter, make sure
the Flutter binary is on your ~PATH~ as well.
2020-02-17 10:12:23 -05:00
** Installing Dart SDK
Before starting note that Flutter SDK will have a version of Dart. Therefore,
there is no need to install Dart. If you want to use Flutter just see
the next part.
The stable version of the SDK is in most major distributions repositories.
If you find it necessary to install any other version or build from source,
please refer to the official website at: https://dart.dev/get-dart
2020-03-27 18:06:31 -04:00
+ *On Debian (also Ubuntu and its derivations):*
#+BEGIN_SRC shell
sudo apt-get install dart
#+END_SRC
+ *On Arch Linux (and derivations like Manjaro):*
#+BEGIN_SRC shell
sudo pacman -S dart
#+END_SRC
+ *On macOS*:
#+BEGIN_SRC shell
brew tap dart-lang/dart
2020-05-31 13:49:38 -07:00
brew install dart
2020-03-27 18:06:31 -04:00
#+END_SRC
2020-07-23 15:36:01 -03:00
+ *On NixOS*:
#+BEGIN_SRC shell
nix-env -iA nixpkgs.dart
#+END_SRC
** Installing Flutter SDK
Due to complications with permissions, it is suggested not to use AUR or any
automatic installation tools for Flutter SDK.
On any system just run the following commands to install Flutter, once you have
met dependencies named on [[https://flutter.dev/docs/get-started/install/][the site]]:
2020-03-27 18:06:31 -04:00
#+BEGIN_SRC shell
git clone https://github.com/flutter/flutter --branch stable # to download Flutter
export PATH="$PATH:$(pwd)/flutter/bin" # to add it to PATH
flutter doctor # for Dependency check and further instructions
#+END_SRC
2020-02-17 10:12:23 -05:00
* Features
2020-03-27 18:06:31 -04:00
+ Syntax highlighting and formatting for ~.dart~ files provided by LSP
2020-07-23 15:36:01 -03:00
+ Auto import
+ Widget guide lines for Flutter
+ Closing labels for constructors
+ Run tests interactively
+ Outline support via ~lsp-treemacs~
2020-02-17 10:12:23 -05:00
+ Emacs functions for running and debugging Flutter projects
* Configuration
** Dart & Flutter
2020-03-27 18:06:31 -04:00
On Linux, the installers for Dart and Flutter use the ~/opt~ directory, and this
module assumes that. However, you may set ~lsp-dart-sdk-dir~ to your Dart
install directory and ~flutter-sdk-path~ to you flutter SDK folder, to make sure
LSP can find the language server included with the Dart SDK.
2020-02-17 10:12:23 -05:00
Alternatively, these variables shouldn't be necessary if you just include Dart
2020-07-23 15:36:01 -03:00
and Flutter on your ~PATH~ variable.
2020-02-17 10:12:23 -05:00
** Android
You will also need to setup your system for Android development if you intend to
use Flutter to develop mobile applications. Refer to your distributions package
2020-03-27 18:06:31 -04:00
manager for details. In most distributions the ~/opt/android-sdk~ directory is
2020-02-17 10:12:23 -05:00
used, and you might have to change some permissions in this directory since it's
owned by root. The [[https://wiki.archlinux.org/index.php/Android][Arch Linux wiki has a great guide on this here.]]
2020-07-23 15:36:01 -03:00
** Flutter mobile development on desktop
[[https://github.com/go-flutter-desktop/go-flutter][Hover]] is an application that can run Flutter mobile apps on your desktop, this
makes the mobile development a lot easier without the need to setup an Android emulator.
2020-02-17 10:12:23 -05:00
* Troubleshooting
See the configuration section for information on the binaries for Dart and
2020-03-27 18:06:31 -04:00
Flutter. On new installs to the ~/opt~ directory, you will likely need to edit
the permissions of the ~/opt/dart-sdk~ and ~/opt/flutter~ directories (not to
2020-02-17 10:12:23 -05:00
mention the Android SDK, as discussed above).