Explain Dart code
Paste Dart, Flutter app code included, and Vibe explains where null is allowed, what a constructor does with its arguments and what each type cast checks.
Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.
Vibe25 lines selected
Press Explain it for the sample, or paste your own code first.
What this Dart sample shows
- null safety
String? artistmay be null and the other three fields may not.json['artist'] as String?lets a missing ornullartist through, andartist ?? 'unknown artist'fills in for it in the label. Writetrack.artist.toUpperCase()and the program doesn't compile: Method 'toUpperCase' cannot be called on 'String?' because it is potentially null.- constructors
const Track({required this.id, ...})takes named arguments and puts each one straight into its field. Leave out arequiredone and the call doesn't compile, whilethis.artistcan be left out and staysnull.factory Track.fromJsonis a constructor that runs code first: it reads the map, then calls the main constructor.- collections
jsonDecodereturnsdynamic, soas List<dynamic>says the body is a list.items.map(...)builds nothing yet: it is a lazyIterablethat makes eachTrackonly when it is read..toList()makes all of them at once into aList<Track>.
Good to know
- Run on
[{"id":"t1","title":"Night Drive","seconds":215,"artist":"Lumen"},{"id":"t2","title":"Intro","seconds":9}],parseTracksgives two tracks labelledNight Drive by Lumen, 3:35andIntro by unknown artist, 0:09. seconds ~/ 60divides and drops the remainder, 3 for 215, and% 60is the 35 left over.padLeft(2, '0')turns 9 into09, so the label reads0:09, not0:9.- A missing
secondsbecomes 0. A decimal like95.9is cut to 95 bytoInt(), not rounded, so that track shows as1:35. Trackdoesn't define==, so two tracks parsed from the same JSON are not equal. Twoconst Track(...)written with the same values are the same object.- The file imports only
dart:convert, not Flutter, so it was run with the plain Dart SDK, and a Flutter app can use it as it is.
Watch out: as checks the type when the code runs and throws if it's wrong. An API that sends "seconds": "215" as text makes parseTracks throw type 'String' is not a subtype of type 'num?' in type cast, and one track with no id gives type 'Null' is not a subtype of type 'String' in type cast. Either way the whole list fails, not just that track.
Explain Dart code beside your editor
Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).
Install on Mac
curl -fsSL https://unvibe.site/install.sh | bashPaste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.
Or download the .dmg · Intel Mac build · SHA-256 checksums
Opening the .dmg the first time
- Open the .dmg and drag Unvibe to Applications.
- Open it once; macOS says it can't verify it. Click Done.

Real screen, macOS 15 - System Settings › Privacy & Security › Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.

Real screen, macOS 15
The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open