Make Intl generated code pass most current lint options
Trying this again, but reverted the "new" removal and one additional type in generated code, as the generated code is used in Dart 1 projects that are still active.

Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating https://github.com/dart-lang/intl_translation/pull/31 but then expanded.
Cloned from CL 264686901 by 'g4 patch'.
Original change by alanknight@alanknight:intl_maintenance:290:citc on 2019/08/21 14:02:13.

PiperOrigin-RevId: 264925581
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fb2630..720558a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 ## 0.16.0
  * Fix 'k' formatting (1 to 24 hours) which incorrectly showed 0 to 23.
+ * Tighten up types in a couple of places.
 
 ## 0.15.8
  * Add return type to some internal methods to improve dart2js output.
diff --git a/lib/intl.dart b/lib/intl.dart
index 5af5d07..67453c4 100644
--- a/lib/intl.dart
+++ b/lib/intl.dart
@@ -94,7 +94,7 @@
   /// [Intl.withLocale] may be preferable if you are using different locales
   /// in the same application.
   static String get defaultLocale {
-    var zoneLocale = Zone.current[#Intl.locale];
+    var zoneLocale = Zone.current[#Intl.locale] as String;
     return zoneLocale == null ? _defaultLocale : zoneLocale;
   }
 
@@ -207,8 +207,9 @@
   ///
   /// Note that null is interpreted as meaning the default locale, so if
   /// [newLocale] is null the default locale will be returned.
-  static String verifiedLocale(String newLocale, Function localeExists,
-      {Function onFailure: _throwLocaleError}) {
+  static String verifiedLocale(
+      String newLocale, bool Function(String) localeExists,
+      {String Function(String) onFailure: _throwLocaleError}) {
     // TODO(alanknight): Previously we kept a single verified locale on the Intl
     // object, but with different verification for different uses, that's more
     // difficult. As a result, we call this more often. Consider keeping
@@ -340,8 +341,15 @@
 
   /// Internal: Implements the logic for plural selection - use [plural] for
   /// normal messages.
-  static pluralLogic(num howMany,
-      {zero, one, two, few, many, other, String locale, int precision,
+  static T pluralLogic<T>(num howMany,
+      {T zero,
+      T one,
+      T two,
+      T few,
+      T many,
+      T other,
+      String locale,
+      int precision,
       String meaning}) {
     if (other == null) {
       throw new ArgumentError("The 'other' named argument must be provided");
@@ -549,7 +557,10 @@
   ///           desc: 'Say Hello');
   ///       Intl.withLocale("zh", new Timer(new Duration(milliseconds:10),
   ///           () => print(hello("World")));
-  static withLocale(String locale, function()) {
+  static dynamic withLocale<T>(String locale, T Function() function) {
+    // TODO(alanknight): Make this return T. This requires work because T might
+    // be Future and the caller could get an unawaited Future.  Which is
+    // probably an error in their code, but the change is semi-breaking.
     var canonical = Intl.canonicalizedLocale(locale);
     return runZoned(function, zoneValues: {#Intl.locale: canonical});
   }
diff --git a/lib/src/intl/date_format.dart b/lib/src/intl/date_format.dart
index 27cc7dc..55901ff 100644
--- a/lib/src/intl/date_format.dart
+++ b/lib/src/intl/date_format.dart
@@ -277,7 +277,7 @@
   /// This will accept dates whose values are not strictly valid, or strings
   /// with additional characters (including whitespace) after a valid date. For
   /// stricter parsing, use [parseStrict].
-  DateTime parse(String inputString, [utc = false]) =>
+  DateTime parse(String inputString, [bool utc = false]) =>
       _parse(inputString, utc: utc, strict: false);
 
   /// Given user input, attempt to parse the [inputString] "loosely" into the
@@ -305,7 +305,7 @@
   ///
   ///      // "Sept" is not a valid month name.
   ///      new DateFormat.yMMMd("en_US").parseLoose("Sept 3, 2014");
-  DateTime parseLoose(String inputString, [utc = false]) {
+  DateTime parseLoose(String inputString, [bool utc = false]) {
     try {
       return _parse(inputString, utc: utc, strict: true);
     } on FormatException {
@@ -313,7 +313,7 @@
     }
   }
 
-  _parseLoose(String inputString, bool utc) {
+  DateTime _parseLoose(String inputString, bool utc) {
     var dateFields = new _DateBuilder();
     if (utc) dateFields.utc = true;
     var stream = new _Stream(inputString);
@@ -334,10 +334,10 @@
   /// DateTime constructor will accept them. It will also rejct strings with
   /// additional characters (including whitespace) after a valid date. For
   /// looser parsing, use [parse].
-  DateTime parseStrict(String inputString, [utc = false]) =>
+  DateTime parseStrict(String inputString, [bool utc = false]) =>
       _parse(inputString, utc: utc, strict: true);
 
-  DateTime _parse(String inputString, {utc: false, strict: false}) {
+  DateTime _parse(String inputString, {bool utc: false, bool strict: false}) {
     // TODO(alanknight): The Closure code refers to special parsing of numeric
     // values with no delimiters, which we currently don't do. Should we?
     var dateFields = new _DateBuilder();
diff --git a/test/fixnum_test.dart b/test/fixnum_test.dart
index 04e65fc..17f5cc2 100644
--- a/test/fixnum_test.dart
+++ b/test/fixnum_test.dart
@@ -80,7 +80,7 @@
 
   test('micro money', () {
     microMoneyValues.forEach((number, expected) {
-      // ignore: deprecated_member_use
+      // ignore: deprecated_member_use_from_same_package
       var currency = new NumberFormat.currencyPattern().format(number);
       expect(currency, expected.first);
       var percent = new NumberFormat.percentPattern().format(number);
diff --git a/test/number_format_test_core.dart b/test/number_format_test_core.dart
index 32f6978..9a54071 100644
--- a/test/number_format_test_core.dart
+++ b/test/number_format_test_core.dart
@@ -149,7 +149,7 @@
     expect(formatted, '€1,000,000.32');
     var readBack = usConvention.parse(formatted);
     expect(readBack, amount);
-    // ignore: deprecated_member_use
+    // ignore: deprecated_member_use_from_same_package
     var swissConvention = new NumberFormat.currencyPattern('de_CH', r'$');
     formatted = swissConvention.format(amount);
     var nbsp = new String.fromCharCode(0xa0);
@@ -159,7 +159,7 @@
     readBack = swissConvention.parse(formatted);
     expect(readBack, amount);
 
-    // ignore: deprecated_member_use
+    // ignore: deprecated_member_use_from_same_package
     var italianSwiss = new NumberFormat.currencyPattern('it_CH', r'$');
     formatted = italianSwiss.format(amount);
     expect(formatted,
@@ -177,7 +177,7 @@
 
     // Verify that we can pass null in order to specify the currency symbol
     // but use the default locale.
-    // ignore: deprecated_member_use
+    // ignore: deprecated_member_use_from_same_package
     var defaultLocale = new NumberFormat.currencyPattern(null, 'Smurfs');
     formatted = defaultLocale.format(amount);
     // We don't know what the exact format will be, but it should have Smurfs.