David PHAM-VAN

Update Analysis options

@@ -33,11 +33,11 @@ analyzer: @@ -33,11 +33,11 @@ analyzer:
33 # Please see https://github.com/flutter/flutter/pull/24528 for details. 33 # Please see https://github.com/flutter/flutter/pull/24528 for details.
34 sdk_version_async_exported_from_core: ignore 34 sdk_version_async_exported_from_core: ignore
35 exclude: 35 exclude:
36 - - 'bin/cache/**' 36 + - "bin/cache/**"
37 # the following two are relative to the stocks example and the flutter package respectively 37 # the following two are relative to the stocks example and the flutter package respectively
38 # see https://github.com/dart-lang/sdk/issues/28463 38 # see https://github.com/dart-lang/sdk/issues/28463
39 - - 'lib/i18n/stock_messages_*.dart'  
40 - - 'lib/src/http/**' 39 + - "lib/i18n/stock_messages_*.dart"
  40 + - "lib/src/http/**"
41 41
42 linter: 42 linter:
43 rules: 43 rules:
@@ -52,7 +52,7 @@ linter: @@ -52,7 +52,7 @@ linter:
52 - annotate_overrides 52 - annotate_overrides
53 # - avoid_annotating_with_dynamic # conflicts with always_specify_types 53 # - avoid_annotating_with_dynamic # conflicts with always_specify_types
54 - avoid_as 54 - avoid_as
55 - # - avoid_bool_literals_in_conditional_expressions # not yet tested 55 + - avoid_bool_literals_in_conditional_expressions
56 # - avoid_catches_without_on_clauses # we do this commonly 56 # - avoid_catches_without_on_clauses # we do this commonly
57 # - avoid_catching_errors # we do this commonly 57 # - avoid_catching_errors # we do this commonly
58 - avoid_classes_with_only_static_members 58 - avoid_classes_with_only_static_members
@@ -90,6 +90,7 @@ linter: @@ -90,6 +90,7 @@ linter:
90 # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 90 # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
91 - control_flow_in_finally 91 - control_flow_in_finally
92 # - curly_braces_in_flow_control_structures # not yet tested 92 # - curly_braces_in_flow_control_structures # not yet tested
  93 + # - diagnostic_describe_all_properties # not yet tested
93 - directives_ordering 94 - directives_ordering
94 - empty_catches 95 - empty_catches
95 - empty_constructor_bodies 96 - empty_constructor_bodies
@@ -120,7 +121,8 @@ linter: @@ -120,7 +121,8 @@ linter:
120 # - parameter_assignments # we do this commonly 121 # - parameter_assignments # we do this commonly
121 - prefer_adjacent_string_concatenation 122 - prefer_adjacent_string_concatenation
122 - prefer_asserts_in_initializer_lists 123 - prefer_asserts_in_initializer_lists
123 - # - prefer_collection_literals # temporary until all platforms support set literals 124 + # - prefer_asserts_with_message # not yet tested
  125 + - prefer_collection_literals
124 - prefer_conditional_assignment 126 - prefer_conditional_assignment
125 - prefer_const_constructors 127 - prefer_const_constructors
126 - prefer_const_constructors_in_immutables 128 - prefer_const_constructors_in_immutables
@@ -128,30 +130,39 @@ linter: @@ -128,30 +130,39 @@ linter:
128 - prefer_const_literals_to_create_immutables 130 - prefer_const_literals_to_create_immutables
129 # - prefer_constructors_over_static_methods # not yet tested 131 # - prefer_constructors_over_static_methods # not yet tested
130 - prefer_contains 132 - prefer_contains
  133 + # - prefer_double_quotes # opposite of prefer_single_quotes
131 - prefer_equal_for_default_values 134 - prefer_equal_for_default_values
132 # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods 135 # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
133 - prefer_final_fields 136 - prefer_final_fields
  137 + # - prefer_final_in_for_each # not yet tested
134 - prefer_final_locals 138 - prefer_final_locals
  139 + # - prefer_for_elements_to_map_fromIterable # not yet tested
135 - prefer_foreach 140 - prefer_foreach
136 # - prefer_function_declarations_over_variables # not yet tested 141 # - prefer_function_declarations_over_variables # not yet tested
137 - prefer_generic_function_type_aliases 142 - prefer_generic_function_type_aliases
  143 + - prefer_if_elements_to_conditional_expressions
  144 + - prefer_if_null_operators
138 - prefer_initializing_formals 145 - prefer_initializing_formals
  146 + - prefer_inlined_adds
139 # - prefer_int_literals # not yet tested 147 # - prefer_int_literals # not yet tested
140 # - prefer_interpolation_to_compose_strings # not yet tested 148 # - prefer_interpolation_to_compose_strings # not yet tested
141 - prefer_is_empty 149 - prefer_is_empty
142 - prefer_is_not_empty 150 - prefer_is_not_empty
143 - prefer_iterable_whereType 151 - prefer_iterable_whereType
144 # - prefer_mixin # https://github.com/dart-lang/language/issues/32 152 # - prefer_mixin # https://github.com/dart-lang/language/issues/32
  153 + # - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
145 - prefer_single_quotes 154 - prefer_single_quotes
  155 + - prefer_spread_collections
146 - prefer_typing_uninitialized_variables 156 - prefer_typing_uninitialized_variables
147 - prefer_void_to_null 157 - prefer_void_to_null
  158 + # - provide_deprecation_message # not yet tested
148 # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml 159 # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
149 - recursive_getters 160 - recursive_getters
150 - slash_for_doc_comments 161 - slash_for_doc_comments
  162 + # - sort_child_properties_last # not yet tested
151 - sort_constructors_first 163 - sort_constructors_first
152 - sort_pub_dependencies 164 - sort_pub_dependencies
153 - sort_unnamed_constructors_first 165 - sort_unnamed_constructors_first
154 - # - super_goes_last # no longer needed w/ Dart 2  
155 - test_types_in_equals 166 - test_types_in_equals
156 - throw_in_finally 167 - throw_in_finally
157 # - type_annotate_public_apis # subset of always_specify_types 168 # - type_annotate_public_apis # subset of always_specify_types
@@ -170,6 +181,8 @@ linter: @@ -170,6 +181,8 @@ linter:
170 - unnecessary_statements 181 - unnecessary_statements
171 - unnecessary_this 182 - unnecessary_this
172 - unrelated_type_equality_checks 183 - unrelated_type_equality_checks
  184 + # - unsafe_html # not yet tested
  185 + - use_full_hex_values_for_flutter_colors
173 # - use_function_type_syntax_for_parameters # not yet tested 186 # - use_function_type_syntax_for_parameters # not yet tested
174 - use_rethrow_when_possible 187 - use_rethrow_when_possible
175 # - use_setters_to_change_properties # not yet tested 188 # - use_setters_to_change_properties # not yet tested
@@ -63,7 +63,7 @@ class PdfDocument { @@ -63,7 +63,7 @@ class PdfDocument {
63 int _objser; 63 int _objser;
64 64
65 /// This vector contains each indirect object within the document. 65 /// This vector contains each indirect object within the document.
66 - final Set<PdfObject> objects = Set<PdfObject>(); 66 + final Set<PdfObject> objects = <PdfObject>{};
67 67
68 /// This is the Catalog object, which is required by each Pdf Document 68 /// This is the Catalog object, which is required by each Pdf Document
69 PdfCatalog catalog; 69 PdfCatalog catalog;
@@ -108,7 +108,7 @@ class PdfDocument { @@ -108,7 +108,7 @@ class PdfDocument {
108 ]; 108 ];
109 109
110 /// This holds the current fonts 110 /// This holds the current fonts
111 - final Set<PdfFont> fonts = Set<PdfFont>(); 111 + final Set<PdfFont> fonts = <PdfFont>{};
112 112
113 /// Generates the document ID 113 /// Generates the document ID
114 List<int> _documentID; 114 List<int> _documentID;
@@ -39,9 +39,9 @@ class PdfNames extends PdfObject { @@ -39,9 +39,9 @@ class PdfNames extends PdfObject {
39 ..putArray(<PdfStream>[ 39 ..putArray(<PdfStream>[
40 page.ref(), 40 page.ref(),
41 PdfStream.string('/XYZ'), 41 PdfStream.string('/XYZ'),
42 - posX == null ? PdfStream.string('null') : PdfStream.num(posX),  
43 - posY == null ? PdfStream.string('null') : PdfStream.num(posY),  
44 - posZ == null ? PdfStream.string('null') : PdfStream.num(posZ), 42 + if (posX == null) PdfStream.string('null') else PdfStream.num(posX),
  43 + if (posY == null) PdfStream.string('null') else PdfStream.num(posY),
  44 + if (posZ == null) PdfStream.string('null') else PdfStream.num(posZ),
45 ]), 45 ]),
46 })); 46 }));
47 } 47 }
@@ -27,10 +27,10 @@ class BoxConstraints { @@ -27,10 +27,10 @@ class BoxConstraints {
27 27
28 /// Creates box constraints that require the given width or height. 28 /// Creates box constraints that require the given width or height.
29 const BoxConstraints.tightFor({double width, double height}) 29 const BoxConstraints.tightFor({double width, double height})
30 - : minWidth = width != null ? width : 0.0,  
31 - maxWidth = width != null ? width : double.infinity,  
32 - minHeight = height != null ? height : 0.0,  
33 - maxHeight = height != null ? height : double.infinity; 30 + : minWidth = width ?? 0.0,
  31 + maxWidth = width ?? double.infinity,
  32 + minHeight = height ?? 0.0,
  33 + maxHeight = height ?? double.infinity;
34 34
35 /// Creates box constraints that is respected only by the given size. 35 /// Creates box constraints that is respected only by the given size.
36 BoxConstraints.tight(PdfPoint size) 36 BoxConstraints.tight(PdfPoint size)
@@ -41,10 +41,10 @@ class BoxConstraints { @@ -41,10 +41,10 @@ class BoxConstraints {
41 41
42 /// Creates box constraints that expand to fill another box constraints. 42 /// Creates box constraints that expand to fill another box constraints.
43 const BoxConstraints.expand({double width, double height}) 43 const BoxConstraints.expand({double width, double height})
44 - : minWidth = width != null ? width : double.infinity,  
45 - maxWidth = width != null ? width : double.infinity,  
46 - minHeight = height != null ? height : double.infinity,  
47 - maxHeight = height != null ? height : double.infinity; 44 + : minWidth = width ?? double.infinity,
  45 + maxWidth = width ?? double.infinity,
  46 + minHeight = height ?? double.infinity,
  47 + maxHeight = height ?? double.infinity;
48 48
49 const BoxConstraints.tightForFinite({ 49 const BoxConstraints.tightForFinite({
50 double width = double.infinity, 50 double width = double.infinity,
@@ -7,7 +7,7 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues @@ -7,7 +7,7 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues
7 version: 1.3.24 7 version: 1.3.24
8 8
9 environment: 9 environment:
10 - sdk: ">=2.1.0 <3.0.0" 10 + sdk: ">=2.3.0 <3.0.0"
11 11
12 dependencies: 12 dependencies:
13 meta: "^1.1.5" 13 meta: "^1.1.5"
@@ -45,7 +45,7 @@ List<Widget> contentMultiPage(Context context) { @@ -45,7 +45,7 @@ List<Widget> contentMultiPage(Context context) {
45 height: 20, 45 height: 20,
46 child: Text( 46 child: Text(
47 'Hello World $n!', 47 'Hello World $n!',
48 - style: TextStyle(fontSize: 15), 48 + style: const TextStyle(fontSize: 15),
49 )), 49 )),
50 ); 50 );
51 } 51 }
@@ -33,11 +33,11 @@ analyzer: @@ -33,11 +33,11 @@ analyzer:
33 # Please see https://github.com/flutter/flutter/pull/24528 for details. 33 # Please see https://github.com/flutter/flutter/pull/24528 for details.
34 sdk_version_async_exported_from_core: ignore 34 sdk_version_async_exported_from_core: ignore
35 exclude: 35 exclude:
36 - - 'bin/cache/**' 36 + - "bin/cache/**"
37 # the following two are relative to the stocks example and the flutter package respectively 37 # the following two are relative to the stocks example and the flutter package respectively
38 # see https://github.com/dart-lang/sdk/issues/28463 38 # see https://github.com/dart-lang/sdk/issues/28463
39 - - 'lib/i18n/stock_messages_*.dart'  
40 - - 'lib/src/http/**' 39 + - "lib/i18n/stock_messages_*.dart"
  40 + - "lib/src/http/**"
41 41
42 linter: 42 linter:
43 rules: 43 rules:
@@ -52,7 +52,7 @@ linter: @@ -52,7 +52,7 @@ linter:
52 - annotate_overrides 52 - annotate_overrides
53 # - avoid_annotating_with_dynamic # conflicts with always_specify_types 53 # - avoid_annotating_with_dynamic # conflicts with always_specify_types
54 - avoid_as 54 - avoid_as
55 - # - avoid_bool_literals_in_conditional_expressions # not yet tested 55 + - avoid_bool_literals_in_conditional_expressions
56 # - avoid_catches_without_on_clauses # we do this commonly 56 # - avoid_catches_without_on_clauses # we do this commonly
57 # - avoid_catching_errors # we do this commonly 57 # - avoid_catching_errors # we do this commonly
58 - avoid_classes_with_only_static_members 58 - avoid_classes_with_only_static_members
@@ -90,6 +90,7 @@ linter: @@ -90,6 +90,7 @@ linter:
90 # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 90 # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
91 - control_flow_in_finally 91 - control_flow_in_finally
92 # - curly_braces_in_flow_control_structures # not yet tested 92 # - curly_braces_in_flow_control_structures # not yet tested
  93 + # - diagnostic_describe_all_properties # not yet tested
93 - directives_ordering 94 - directives_ordering
94 - empty_catches 95 - empty_catches
95 - empty_constructor_bodies 96 - empty_constructor_bodies
@@ -120,7 +121,8 @@ linter: @@ -120,7 +121,8 @@ linter:
120 # - parameter_assignments # we do this commonly 121 # - parameter_assignments # we do this commonly
121 - prefer_adjacent_string_concatenation 122 - prefer_adjacent_string_concatenation
122 - prefer_asserts_in_initializer_lists 123 - prefer_asserts_in_initializer_lists
123 - # - prefer_collection_literals # temporary until all platforms support set literals 124 + # - prefer_asserts_with_message # not yet tested
  125 + - prefer_collection_literals
124 - prefer_conditional_assignment 126 - prefer_conditional_assignment
125 - prefer_const_constructors 127 - prefer_const_constructors
126 - prefer_const_constructors_in_immutables 128 - prefer_const_constructors_in_immutables
@@ -128,30 +130,39 @@ linter: @@ -128,30 +130,39 @@ linter:
128 - prefer_const_literals_to_create_immutables 130 - prefer_const_literals_to_create_immutables
129 # - prefer_constructors_over_static_methods # not yet tested 131 # - prefer_constructors_over_static_methods # not yet tested
130 - prefer_contains 132 - prefer_contains
  133 + # - prefer_double_quotes # opposite of prefer_single_quotes
131 - prefer_equal_for_default_values 134 - prefer_equal_for_default_values
132 # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods 135 # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
133 - prefer_final_fields 136 - prefer_final_fields
  137 + # - prefer_final_in_for_each # not yet tested
134 - prefer_final_locals 138 - prefer_final_locals
  139 + # - prefer_for_elements_to_map_fromIterable # not yet tested
135 - prefer_foreach 140 - prefer_foreach
136 # - prefer_function_declarations_over_variables # not yet tested 141 # - prefer_function_declarations_over_variables # not yet tested
137 - prefer_generic_function_type_aliases 142 - prefer_generic_function_type_aliases
  143 + - prefer_if_elements_to_conditional_expressions
  144 + - prefer_if_null_operators
138 - prefer_initializing_formals 145 - prefer_initializing_formals
  146 + - prefer_inlined_adds
139 # - prefer_int_literals # not yet tested 147 # - prefer_int_literals # not yet tested
140 # - prefer_interpolation_to_compose_strings # not yet tested 148 # - prefer_interpolation_to_compose_strings # not yet tested
141 - prefer_is_empty 149 - prefer_is_empty
142 - prefer_is_not_empty 150 - prefer_is_not_empty
143 - prefer_iterable_whereType 151 - prefer_iterable_whereType
144 # - prefer_mixin # https://github.com/dart-lang/language/issues/32 152 # - prefer_mixin # https://github.com/dart-lang/language/issues/32
  153 + # - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
145 - prefer_single_quotes 154 - prefer_single_quotes
  155 + - prefer_spread_collections
146 - prefer_typing_uninitialized_variables 156 - prefer_typing_uninitialized_variables
147 - prefer_void_to_null 157 - prefer_void_to_null
  158 + # - provide_deprecation_message # not yet tested
148 # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml 159 # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
149 - recursive_getters 160 - recursive_getters
150 - slash_for_doc_comments 161 - slash_for_doc_comments
  162 + # - sort_child_properties_last # not yet tested
151 - sort_constructors_first 163 - sort_constructors_first
152 - sort_pub_dependencies 164 - sort_pub_dependencies
153 - sort_unnamed_constructors_first 165 - sort_unnamed_constructors_first
154 - # - super_goes_last # no longer needed w/ Dart 2  
155 - test_types_in_equals 166 - test_types_in_equals
156 - throw_in_finally 167 - throw_in_finally
157 # - type_annotate_public_apis # subset of always_specify_types 168 # - type_annotate_public_apis # subset of always_specify_types
@@ -170,6 +181,8 @@ linter: @@ -170,6 +181,8 @@ linter:
170 - unnecessary_statements 181 - unnecessary_statements
171 - unnecessary_this 182 - unnecessary_this
172 - unrelated_type_equality_checks 183 - unrelated_type_equality_checks
  184 + # - unsafe_html # not yet tested
  185 + - use_full_hex_values_for_flutter_colors
173 # - use_function_type_syntax_for_parameters # not yet tested 186 # - use_function_type_syntax_for_parameters # not yet tested
174 - use_rethrow_when_possible 187 - use_rethrow_when_possible
175 # - use_setters_to_change_properties # not yet tested 188 # - use_setters_to_change_properties # not yet tested
@@ -201,22 +201,23 @@ class MyAppState extends State<MyApp> { @@ -201,22 +201,23 @@ class MyAppState extends State<MyApp> {
201 RaisedButton( 201 RaisedButton(
202 child: const Text('Print Markdown'), 202 child: const Text('Print Markdown'),
203 onPressed: _printMarkdown), 203 onPressed: _printMarkdown),
204 - canDebug  
205 - ? Row(  
206 - mainAxisSize: MainAxisSize.min,  
207 - children: <Widget>[  
208 - const Text('Debug'),  
209 - Switch.adaptive(  
210 - onChanged: (bool value) {  
211 - setState(() {  
212 - pdf.Document.debug = value;  
213 - });  
214 - },  
215 - value: pdf.Document.debug,  
216 - ),  
217 - ],  
218 - )  
219 - : const SizedBox(), 204 + if (canDebug)
  205 + Row(
  206 + mainAxisSize: MainAxisSize.min,
  207 + children: <Widget>[
  208 + const Text('Debug'),
  209 + Switch.adaptive(
  210 + onChanged: (bool value) {
  211 + setState(() {
  212 + pdf.Document.debug = value;
  213 + });
  214 + },
  215 + value: pdf.Document.debug,
  216 + ),
  217 + ],
  218 + )
  219 + else
  220 + const SizedBox(),
220 ], 221 ],
221 ), 222 ),
222 ), 223 ),
@@ -4,7 +4,7 @@ description: Pdf Printing Example @@ -4,7 +4,7 @@ description: Pdf Printing Example
4 version: 1.0.0+1 4 version: 1.0.0+1
5 5
6 environment: 6 environment:
7 - sdk: ">=2.1.0 <3.0.0" 7 + sdk: ">=2.3.0 <3.0.0"
8 8
9 dependencies: 9 dependencies:
10 flutter: 10 flutter:
@@ -7,7 +7,7 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues @@ -7,7 +7,7 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues
7 version: 2.1.8 7 version: 2.1.8
8 8
9 environment: 9 environment:
10 - sdk: ">=2.1.0 <3.0.0" 10 + sdk: ">=2.3.0 <3.0.0"
11 flutter: "^1.7.0" 11 flutter: "^1.7.0"
12 12
13 dependencies: 13 dependencies: