Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dartdoc failed: Top level package requires Flutter but FLUTTER_ROOT environment variable not set

I am trying to run dartdoc for my flutter package but I am getting this,

dartdoc failed: Top level package requires Flutter but FLUTTER_ROOT environment variable not set.

How to add FLUTTER_ROOT environment variable as I have already added environment variable for Flutter SDK and that's working fine, I am just getting issue while running dartdoc. I am a Linux user.

like image 431
Shahzad Akram Avatar asked Apr 07 '20 17:04

Shahzad Akram


Video Answer


2 Answers

try running flutter pub global run dartdoc:dartdoc instead

like image 179
Qiong Wu Avatar answered Oct 22 '22 18:10

Qiong Wu


If you wish to generate API documentation locally on your development machine, use the following commands:

  1. Change directory to the location of your package:
cd ~/dev/mypackage  
  1. Tell the documentation tool where the Flutter SDK is located (change the following commands to reflect where you placed it):
export FLUTTER_ROOT=~/dev/flutter  # on macOS or Linux  
set FLUTTER_ROOT=~/dev/flutter     # on Windows   
  1. Run the dartdoc tool (included as part of the Flutter SDK), as follows:
$FLUTTER_ROOT/bin/cache/dart-sdk/bin/dartdoc   # on macOS or Linux  
%FLUTTER_ROOT%\bin\cache\dart-sdk\bin\dartdoc   # on Windows

link https://flutter.dev/docs/development/packages-and-plugins/developing-packages

like image 39
Wizz.Xu Avatar answered Oct 22 '22 19:10

Wizz.Xu