flutter print code example

Example 1: flutter print

void main() {
    var test = "test";
    print('test = $test');
}

Example 2: how to log data to the flutter console ?

import 'package:flutter/foundation.dart';

debugPrint('movieTitle: $movieTitle');

Example 3: print flutter objects

/// since Dart 3.12 you can use `inspect` 
inspect(object)

Example 4: print dart

import 'dart:html';

main() {
  var value = querySelector('input').value;
  print('The value of the input is: $value');
}

Example 5: how to log data to the flutter console ?

print('counter value : $_counter');

Tags: