Agent skill

how-to-print-multiple-objects-to-the-console-with-print-in-dart

Learn how to print multiple objects to the console in Dart using Records, offering a similar experience to JavaScript's `console.log()` functionality.

Stars 37
Forks 5

Install this agent skill to your Project

npx add-skill https://github.com/rodydavis/skills/tree/main/skills/dart_print-multiple-objects

Metadata

Additional technical details for this skill

last modified
Tue, 03 Feb 2026 20:04:33 GMT

SKILL.md

How to Print Multiple Objects to the Console with print() in Dart

If you are coming from JavaScript you may be used to printing multiple objects to the console with console.log():

console.log('a', 1, 'b', 2); // a 1 b 2

In Dart we can only print Object? to the console with print():

print(1); // 1
print(null); // null
print({'a': 1, 'b': 2}); // {a: 1, b: 1}

But it is totally possible to print multiple objects too, we need to use Records:

final number = 1;
final str = 'Hello World';

print((number, str));

print((DateTime.now(), str));

print((DateTime.now(), count: number, description: str));

print((DateTime.now(), StackTrace.current));

Print the following:

(1, Hello World)
(2024-03-06 15:48:26.514, Hello World)
(2024-03-06 15:48:26.514, count: 1, description: Hello World)
(2024-03-06 15:48:26.514, Error
    at get current [as current] (https://storage.googleapis.com/nnbd_artifacts/3.3.0/dart_sdk.js:139991:30)
    at Object.main$0 [as main] (<anonymous>:52:94)
    at Object.main$ [as main] (<anonymous>:44:10)
    at <anonymous>:89:26
    at Object.execCb (https://dartpad.dev/require.js:5:16727)
    at e.check (https://dartpad.dev/require.js:5:10499)
    at e.<anonymous> (https://dartpad.dev/require.js:5:12915)
    at https://dartpad.dev/require.js:5:1542
    at https://dartpad.dev/require.js:5:13376
    at each (https://dartpad.dev/require.js:5:1020)
    at e.emit (https://dartpad.dev/require.js:5:13344)
    at e.check (https://dartpad.dev/require.js:5:11058)
    at e.enable (https://dartpad.dev/require.js:5:13242)
    at e.init (https://dartpad.dev/require.js:5:9605)
    at a (https://dartpad.dev/require.js:5:8305)
    at Object.completeLoad (https://dartpad.dev/require.js:5:15962)
    at HTMLScriptElement.onScriptLoad (https://dartpad.dev/require.js:5:16882))

Demo

Expand your agent's capabilities with these related and highly-rated skills.

rodydavis/skills

how-to-do-offline-recommendations-with-sqlite-and-gemini

Learn how to enhance your CMS like PocketBase with AI-powered content recommendations using text embeddings, SQLite, and k-nearest neighbor search for efficient and scalable related content suggestions.

37 5
Explore
rodydavis/skills

how-to-build-a-webrtc-signal-server-with-pocketbase

Learn how to build a simple WebRTC video call application using PocketBase as a signaling server, enabling peer-to-peer communication with SQLite on the server and realtime updates via Server Sent Events.

37 5
Explore
rodydavis/skills

flutter-terminal-cheat-sheet

This post provides a handy collection of Flutter commands and scripts for web development, package creation, troubleshooting, testing, and more, streamlining your Flutter workflow.

37 5
Explore
rodydavis/skills

flutter-input-output-preview

Build responsive Flutter apps with a reusable `TwoPane` widget and an `InputOutputPreview` component for side-by-side code and preview display on both mobile and desktop.

37 5
Explore
rodydavis/skills

displaying-html-in-flutter

Easily display and interact with HTML content in your Flutter app using the `easy_web_view` package, which supports both web and mobile platforms.

37 5
Explore
rodydavis/skills

how-to-export-sqlite-tables-to-create-statements

Learn how to export your entire SQLite database schema, including tables and indexes, into runnable CREATE statements at runtime using Flutter and the `sqlite3` package.

37 5
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results