[{"id":"dartadvanced-001","courseId":"dart-advanced","domain":"variables-and-operators","topic":"Symbols and minification","prompt":"A registry looks up methods by name, and your release build is minified. Which argument still lets it find refreshCache in the class below?","hint":"Think about what survives renaming in a minified build.","explain":"Minification renames identifiers in release builds, so plain text can stop matching the code. Dart has a compile-time constant that names an identifier and survives renaming.","source":"https://dart.dev/language/built-in-types","interaction":{"type":"single"},"options":[{"id":"a","text":"#refreshCache","why":"A symbol literal is a compile-time constant naming the identifier, and minification changes identifier names but not symbols."},{"id":"b","text":"'refreshCache'","whyNot":"A string is only text. Minification renames identifiers, so text copied from the code may no longer match them."},{"id":"c","text":"refreshCache","whyNot":"A bare identifier is a reference to the method itself, so the registry receives the method rather than its name."},{"id":"d","text":"refreshCache()","whyNot":"The parentheses call the method right away, so the registry receives the result of the call, not a name."}],"answer":"a","explanation":"Minification changes identifier names but not symbols, so APIs that refer to members by name should take a symbol literal rather than text.","concept":"Minification changes identifier names but not symbols, so APIs that refer to members by name should take a symbol literal rather than text.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","code":"class Cache {\n  void refreshCache() {}\n}","takeaways":["Pass symbol literals, not strings or bare names, to APIs that look up members by name."]},{"id":"dartadvanced-002","courseId":"dart-advanced","domain":"variables-and-operators","topic":"Integer width by platform","prompt":"On the web, a Dart int has the same range as on native platforms, from -2^63 to 2^63 - 1.","hint":"Think about what the web runtime uses to represent integers.","explain":"An integer type's range is set by how the platform represents numbers, and floating-point values hold whole numbers only up to a limit. That limit can be smaller than a 64-bit range.","source":"https://dart.dev/language/built-in-types","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"On the web, integers are JavaScript numbers, so their range is much smaller than on native platforms."},{"id":"b","text":"False","why":"Native platforms span -2^63 to 2^63 - 1, but on the web integers are JavaScript numbers limited to -2^53 to 2^53 - 1."}],"answer":"b","explanation":"Native Dart ints span -2^63 to 2^63 - 1, but on the web they are JavaScript numbers limited to -2^53 to 2^53 - 1.","concept":"Native Dart ints span -2^63 to 2^63 - 1, but on the web they are JavaScript numbers limited to -2^53 to 2^53 - 1.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Web builds get a much smaller exact integer range than native builds."]},{"id":"dartadvanced-003","courseId":"dart-advanced","domain":"variables-and-operators","topic":"Runes and characters","prompt":"A program prints the string 'Hi 🇩🇰' and writes some Unicode escapes. Which TWO statements about Unicode in Dart strings are correct?","hint":"Two APIs read a string at different levels, and escapes have two forms.","explain":"A string can be read as its code points or as the characters a reader sees, and the two views can disagree. Escapes have a fixed short form, plus a bracketed form for other digit counts.","source":"https://dart.dev/language/built-in-types","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"Read the characters getter from the characters package for grapheme clusters.","why":"The characters getter returns the string as a sequence of grapheme clusters, the user-perceived characters."},{"id":"b","text":"Write \\u{1f606} for a code point that needs more or fewer than four hex digits.","why":"Curly brackets allow more or fewer than four hex digits, as in the laughing emoji."},{"id":"c","text":"Runes and characters always give the same count, since each rune is one character.","whyNot":"Runes are code points, but characters are grapheme clusters, which can be built from several code points."},{"id":"d","text":"\\u{2665} and \\u2665 produce different characters.","whyNot":"Curly brackets only change how many hex digits are written; both forms give the same heart character."},{"id":"e","text":"A Dart string is a sequence of UTF-8 bytes, so runes match its bytes.","whyNot":"The page says a Dart string is a sequence of UTF-16 code units, not UTF-8 bytes."},{"id":"f","text":"The characters getter ships in dart:core, so no package import is needed.","whyNot":"The page says the characters getter comes from the characters package, which must be imported."}],"answer":"ab","explanation":"Runes expose code points, the characters package gives user-perceived grapheme clusters, and \\uXXXX takes four hex digits while braces take any other count.","concept":"Runes expose code points, the characters package gives user-perceived grapheme clusters, and \\uXXXX takes four hex digits while braces take any other count.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Use runes for code points and the characters API for what users see as one character."]},{"id":"dartadvanced-004","courseId":"dart-advanced","domain":"variables-and-operators","topic":"Null-aware member access","prompt":"The cascade below should run none of its calls when button is null. Which operator should begin the cascade?","hint":"Focus on the operator in front of the first .. in the chain.","explain":"A cascade runs several operations on one object, and the operator at its start decides what happens when that object is missing. Some operators in this family supply a fallback, some assert, and some skip.","source":"https://dart.dev/language/operators","interaction":{"type":"single"},"options":[{"id":"a","text":"?..","why":"A null-shorting cascade on the first operation means no cascade operation is attempted on a null object."},{"id":"b","text":"??","whyNot":"?? gives a fallback value when the left side is null, such as a default name. It does not skip later operations."},{"id":"c","text":"!","whyNot":"! asserts that a value is non-null and throws at runtime if it isn't, so it fails instead of skipping."},{"id":"d","text":"...?","whyNot":"...? is a null-aware spread inside a collection literal, not a cascade operator."}],"answer":"a","explanation":"A null-shorting cascade (?..) on the first operation guarantees that none of the cascade operations are attempted when the object is null.","concept":"A null-shorting cascade (?..) on the first operation guarantees that none of the cascade operations are attempted when the object is null.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","code":"Button? button = findButton();\nbutton\n  ?..text = 'Confirm'\n  ..addClass('important')\n  ..scrollIntoView();","takeaways":["Start a cascade with ?.. when its target can be null."]},{"id":"dartadvanced-005","courseId":"dart-advanced","domain":"variables-and-operators","topic":"Nested block comments","prompt":"A developer comments out code, and the block already contains a comment. What does the Dart compiler do with the print call in this file?","hint":"Count how many openers are still unmatched at each closer.","explain":"Block comments in this language can contain their own pairs, so a closing marker doesn't always end the whole comment. The compiler tracks how many openings are still unmatched before it treats text as code.","source":"https://dart.dev/language/comments","interaction":{"type":"single"},"options":[{"id":"a","text":"It ignores the print call, since the outer comment is still open","why":"Multi-line comments can nest, so the first */ only closes the inner comment and the outer one continues to the last */."},{"id":"b","text":"It runs the print call, because the first */ closes the comment","whyNot":"That is how a comment without nesting behaves; here the inner pair leaves the outer comment still open."},{"id":"c","text":"It reports an error at the first */, because comments can't nest","whyNot":"Dart comments can nest, so the first */ is not an error."},{"id":"d","text":"It ignores the print call, but the last */ is a compile error","whyNot":"The last */ closes the outer comment, so the file is valid and nothing after the comment is affected."}],"answer":"a","explanation":"Multi-line comments can nest in Dart: a /* inside a comment opens another level, and text stays commented until the outermost */ closes it.","concept":"Multi-line comments can nest in Dart: a /* inside a comment opens another level, and text stays commented until the outermost */ closes it.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","code":"/* step one /* step two */\nprint('running');\n*/\nvoid main() {}","takeaways":["Dart block comments nest, so an inner */ may not end the comment you expect."]}]