Skip to content

Instantly share code, notes, and snippets.

@natebosch
Last active October 28, 2016 18:59
Show Gist options
  • Save natebosch/102529d424c29193fadbf07c33516259 to your computer and use it in GitHub Desktop.
Save natebosch/102529d424c29193fadbf07c33516259 to your computer and use it in GitHub Desktop.
import 'dart:math';
final random = new Random();
void main() {
var isString;
if (random.nextBool()) {
isString = 'It is a string';
isString.notAMethod(); // Analyzer sees a String
} else {
isString = 'no really, always';
isString.notAMethod();
}
isString.notAMethod(); // Analyzer sees dynamic
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment