Support
Flutter Print is an extension created for Visual Studio Code. If you find it useful, please consider supporting it.
Flutter Print
Easily insert and remove log('variable: $variable');
statement.
Tutorial in Portuguese Brazil.
Usage Examples
This extension overrides the shortcut for Select all occurrences of current selection - Ctrl+Shift+L
on Windows and Linux and Cmd+Shift+L
on macOS, however you can still use Ctrl+F2
to execute same command.
Settings
The Flutter Print extension has only one configuration option called useDebugPrint
which is used to define whether the debugPrint statement will be used instead of the print statement.
log for variables or object properties:
With the extension setting log
enabled, select the variable or object properties that you want uses debugPrint statement and press Ctrl+Shift+L
on Windows, Linux or macOS.
debugPrint for variables or object properties:
With the extension setting debugPrint
enabled, select the variable or object properties that you want uses debugPrint statement and press Ctrl+Shift+L
on Windows, Linux or macOS.
Print for variables or object properties:
With the extension setting print
enabled, select the variable or object properties that you want uses print statement and press Ctrl+Shift+L
on Windows, Linux or macOS.
Remove all print statements:
To remove all print statements and press Win+Shift+D
on Windows and Linux or Cmd+Shift+D
on macOS.
With Custom Log Class
Create a custom log class.
import 'dart:developer' as developer;
class Log {
Log._();
static void print(String value, {StackTrace? stackTrace}) {
developer.log(value, name: 'LOG', stackTrace: stackTrace);
}
static Object? inspect(Object? object) {
return developer.inspect(object);
}
}
Log.print() for variables or object properties:
Select the variable or object properties that you want uses a custom Log.print statement and press Win+Ctrl+L
on Windows and Linux or Cmd+Ctrl+L
on macOS.
Log.inspect() for variables:
Select the variable that you want uses a custom Log.inspect statement and press Win+Ctrl+L
on Windows and Linux or Cmd+Ctrl+L
on macOS.
That's all, Enjoy!