Open devoncarew opened 8 years ago
That seems excessively fussy of the build system. They don't have a way to not check generated code?
We could probably make that work, but it's not trivial. It would have to generate the code, look to see if it used any constructs that require the Intl library, and only include the import if it did. Or, I suppose it could be "fixed" more easily by adding some constant thing that used Intl and was never called. But that doesn't really seem desirable.
Perhaps there's an easy way to know when generating a file if it'll use package:intl/intl.dart
? Or, an easy way to know if it won't use the package. Then you wouldn't have to do the work of doing a full analysis post-generation. I agree that that wouldn't be great.
I do think it's a good goal though to generate analysis clean code. Also, perhaps code with few or no dartfmt formatting diffs.
Some formatting changes here: https://github.com/dart-lang/intl/pull/95
It wouldn't need to be a full analysis, it would just need something like a flag for whether constructs requiring that import were used when generating any particular message, and deferring writing anything until after all the messages had been generated.
See also dart-lang/i18n#186 .
This causes issues with build systems that check code for no warnings or info level messages. In this file (https://github.com/flutter/flutter/blob/master/examples/stocks/lib/i18n/stock_messages_es.dart#L9), the
import 'package:intl/intl.dart';
line is unused.