{"size":870,"ext":"dart","lang":"Dart","max_stars_count":8969.0,"content":"\/\/ Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\n\/\/ @dart = 2.9\n\nlibrary lib51;\n\nimport 'regress1751477_lib1.dart';\nimport 'regress1751477_lib2.dart';\nimport 'regress1751477_lib3.dart';\nimport 'regress1751477_lib4.dart';\nimport 'regress1751477_lib5.dart';\nimport 'regress1751477_lib6.dart';\nimport 'regress1751477_lib7.dart';\nimport 'regress1751477_lib8.dart';\nimport 'regress1751477_lib9.dart';\n\nimport 'regress1751477_lib11.dart';\nimport 'regress1751477_lib21.dart';\nimport 'regress1751477_lib31.dart';\nimport 'regress1751477_lib41.dart';\nimport 'regress1751477_lib61.dart';\nimport 'regress1751477_lib71.dart';\nimport 'regress1751477_lib81.dart';\nimport 'regress1751477_lib91.dart';\n\nlib51_func() {}\n","avg_line_length":30.0,"max_line_length":77,"alphanum_fraction":0.7942528736} {"size":2203,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:sqlparser\/sqlparser.dart';\nimport 'package:test\/test.dart';\n\nimport 'utils.dart';\n\nfinal _block = Block([\n UpdateStatement(table: TableReference('tbl'), set: [\n SetComponent(\n column: Reference(columnName: 'foo'),\n expression: Reference(columnName: 'bar'),\n ),\n ]),\n SelectStatement(\n columns: [StarResultColumn()],\n from: TableReference('tbl'),\n ),\n]);\n\nvoid main() {\n test('parses create trigger statements', () {\n const sql = '''\n CREATE TRIGGER IF NOT EXISTS my_trigger\n AFTER DELETE ON tbl\n FOR EACH ROW\n BEGIN\n UPDATE tbl SET foo = bar;\n SELECT * FROM tbl;\n END;\n ''';\n\n testStatement(\n sql,\n CreateTriggerStatement(\n ifNotExists: true,\n triggerName: 'my_trigger',\n mode: TriggerMode.after,\n target: const DeleteTarget(),\n onTable: TableReference('tbl'),\n action: _block,\n ),\n );\n });\n\n test('with INSTEAD OF mode and UPDATE', () {\n const sql = '''\n CREATE TRIGGER my_trigger\n INSTEAD OF UPDATE OF foo, bar ON tbl\n BEGIN\n UPDATE tbl SET foo = bar;\n SELECT * FROM tbl;\n END;\n ''';\n\n testStatement(\n sql,\n CreateTriggerStatement(\n triggerName: 'my_trigger',\n mode: TriggerMode.insteadOf,\n target: UpdateTarget([\n Reference(columnName: 'foo'),\n Reference(columnName: 'bar'),\n ]),\n onTable: TableReference('tbl'),\n action: _block,\n ),\n );\n });\n\n test('with BEFORE, INSERT and WHEN clause', () {\n const sql = '''\n CREATE TRIGGER my_trigger\n BEFORE INSERT ON tbl\n WHEN new.foo IS NULL\n BEGIN\n UPDATE tbl SET foo = bar;\n SELECT * FROM tbl;\n END;\n ''';\n\n testStatement(\n sql,\n CreateTriggerStatement(\n triggerName: 'my_trigger',\n mode: TriggerMode.before,\n target: const InsertTarget(),\n onTable: TableReference('tbl'),\n when: IsExpression(\n false,\n Reference(tableName: 'new', columnName: 'foo'),\n NullLiteral(token(TokenType.$null)),\n ),\n action: _block,\n ),\n );\n });\n}\n","avg_line_length":22.7113402062,"max_line_length":57,"alphanum_fraction":0.5587834771} {"size":2785,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ import 'package:flutter\/material.dart';\n\/\/ import 'package:pelu\/Estilos\/estilos.dart';\n\/\/ import 'package:pelu\/funciones.dart';\n\/\/ import 'package:pelu\/turno.dart';\n\/\/ import 'package:provider\/provider.dart';\n\/\/ import 'package:pelu\/Provider\/fecha.dart';\n\n\/\/ Future> cancelarTurno({\n\/\/ BuildContext context,\n\/\/ Turno turno,\n\/\/ String fechaString,\n\/\/ List ocupados,\n\/\/ List disponibles,\n\/\/ }) async {\n\/\/ FechaProvider fechaProvider = Provider.of(context);\n\/\/ return await showDialog(\n\/\/ context: context,\n\/\/ builder: (context) {\n\/\/ return AlertDialog(\n\/\/ shape: RoundedRectangleBorder(\n\/\/ borderRadius: BorderRadius.circular(10),\n\/\/ ),\n\/\/ content: Container(\n\/\/ height: 150,\n\/\/ width: 500,\n\/\/ child: Column(\n\/\/ children: [\n\/\/ Row(\n\/\/ children: [\n\/\/ Spacer(),\n\/\/ Text('$fechaString'),\n\/\/ ],\n\/\/ ),\n\/\/ SizedBox(height: 15),\n\/\/ Row(\n\/\/ children: [\n\/\/ Text(\n\/\/ 'Estas seguro de cancelar este turno?',\n\/\/ style: infoPopUp,\n\/\/ ),\n\/\/ Spacer(),\n\/\/ ],\n\/\/ ),\n\/\/ SizedBox(height: 10),\n\/\/ Text(\n\/\/ '${turno.cliente} a las ${turno.horario}',\n\/\/ style: tituloPopUp,\n\/\/ ),\n\/\/ Spacer(),\n\/\/ Container(\n\/\/ width: 500,\n\/\/ height: 40,\n\/\/ decoration: BoxDecoration(\n\/\/ color: rojo,\n\/\/ borderRadius: BorderRadius.circular(10),\n\/\/ ),\n\/\/ child: ElevatedButton(\n\/\/ style: botonCancelarPopUp,\n\/\/ onPressed: () {\n\/\/ cancelarTurnoFirebase(\n\/\/ turno: turno,\n\/\/ fechaFirebase: fechaString,\n\/\/ turnosOcupados: ocupados,\n\/\/ turnosDisponibles: disponibles,\n\/\/ ).then((map) {\n\/\/ print('retornamos map');\n\/\/ fechaProvider.actualizarTurnos(map: map);\n\/\/ });\n\/\/ Navigator.of(context).pop();\n\/\/ },\n\/\/ child: Text('Cancelar Turno', style: textoPopUp),\n\/\/ ),\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ );\n\/\/ });\n\/\/ }\n","avg_line_length":34.8125,"max_line_length":72,"alphanum_fraction":0.3960502693} {"size":490,"ext":"dart","lang":"Dart","max_stars_count":6.0,"content":"import 'package:firebase_core\/firebase_core.dart';\nimport 'package:flutter_starter_project\/core\/di\/injection.dart';\nimport 'package:flutter_test\/flutter_test.dart';\nimport 'package:shared_preferences\/shared_preferences.dart';\n\nimport 'helpers.dart';\n\nvoid widgetSetup() {\n setUpAll(() async {\n TestWidgetsFlutterBinding.ensureInitialized();\n SharedPreferences.setMockInitialValues({});\n setupFirebaseMessagingMocks();\n await init();\n await Firebase.initializeApp();\n });\n}\n","avg_line_length":28.8235294118,"max_line_length":64,"alphanum_fraction":0.7714285714} {"size":3550,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'package:base_bloc\/base_bloc.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:bottom_navy_bar\/bottom_navy_bar.dart';\nimport 'package:flutter_statusbar_manager\/flutter_statusbar_manager.dart';\nimport 'package:money_manager\/repository\/dto\/session_dto.dart';\nimport 'package:money_manager\/utils\/money_manager_icons.dart';\nimport 'package:money_manager\/utils\/style.dart';\nimport 'package:money_manager\/view\/home\/accounts\/accounts_widget.dart';\nimport 'package:money_manager\/view\/home\/loan\/loan_widget.dart';\nimport 'package:money_manager\/view\/home\/others\/others_widget.dart';\nimport 'package:money_manager\/view\/home\/overview\/overview_widget.dart';\nimport 'package:money_manager\/view\/mm_localizations_delegate.dart';\nimport '.\/home_widget_export.dart';\n\nclass HomeWidget extends StatefulWidget{\n\n final SessionDto session;\n\n const HomeWidget({Key key, this.session}) : super(key: key);\n\n @override\n State createState() => _HomeWidgetState();\n}\n\nclass _HomeWidgetState extends BaseBlocState with TickerProviderStateMixin {\n\n BuildContext _context;\n\n @override\n Widget build(BuildContext context) => BaseBlocBuilder(bloc, _buildBody);\n\n @override\n BaseBloc createBloc() => HomeBloc();\n TabController _tabController;\n List pages;\n\n @override\n void initState() {\n super.initState();\n pages = _getListPage();\n _tabController = TabController(vsync: this, length: pages.length);\n }\n\n @override\n void dispose() {\n pages.clear();\n _tabController.dispose();\n super.dispose();\n }\n\n Widget _buildBody(BuildContext context, HomeState state) {\n _updateStatusBar();\n _tabController.animateTo(state.tabIndex);\n return Container(\n color: MyColors.mainColor,\n child: SafeArea(\n child: Scaffold(\n body: TabBarView(children: pages, controller: _tabController,\n physics: NeverScrollableScrollPhysics()),\n bottomNavigationBar: BottomNavyBar(\n backgroundColor: MyColors.mainColor,\n selectedIndex: state.tabIndex,\n showElevation: true,\n onItemSelected: (index) => dispatch(HomeEventChangTab(tabIndex: index)),\n items: [\n BottomNavyBarItem(\n icon: Icon(Icons.desktop_mac),\n title: Text(MoneyManagerLocalizations.of(context).titleOverView),\n activeColor: Colors.white,\n ),\n BottomNavyBarItem(\n icon: Icon(MoneyManager.wallet),\n title: Text(MoneyManagerLocalizations.of(context).titleAccounts),\n activeColor: Colors.white\n ),\n BottomNavyBarItem(\n icon: Icon(Icons.description),\n title: Text(MoneyManagerLocalizations.of(context).titleLoan),\n activeColor: Colors.white\n ),\n BottomNavyBarItem(\n icon: Icon(Icons.more_horiz),\n title: Text(MoneyManagerLocalizations.of(context).titleOthers),\n activeColor: Colors.white\n ),\n ],\n ),\n ),\n ),\n );\n }\n\n Future _updateStatusBar() async {\n try {\n await FlutterStatusbarManager.setStyle(StatusBarStyle.LIGHT_CONTENT);\n await FlutterStatusbarManager.setNavigationBarStyle(\n NavigationBarStyle.LIGHT);\n } catch (e) {\n print('_updateStatusBar ----> $e');\n }\n }\n\n _getListPage() => [\n OverviewWidget(),\n AccountsWidget(),\n LoanWidget(),\n OthersWidget(),\n ];\n}\n\n","avg_line_length":31.981981982,"max_line_length":88,"alphanum_fraction":0.6676056338} {"size":2313,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:elaichi\/auth\/domain\/repository\/auth_repository.dart';\nimport 'package:elaichi\/home\/application\/home_cubit.dart';\nimport 'package:elaichi\/widgets\/buttons.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter_bloc\/flutter_bloc.dart';\nimport 'package:go_router\/go_router.dart';\n\n\/\/\/ The Landing Page of the app.\nclass HomePage extends StatelessWidget {\n \/\/\/ Constructor for [HomePage].\n const HomePage({\n Key? key,\n required AuthenticationRepository authenticationRepository,\n }) : _authenticationRepository = authenticationRepository,\n super(key: key);\n\n final AuthenticationRepository _authenticationRepository;\n\n @override\n Widget build(BuildContext context) {\n return RepositoryProvider.value(\n value: _authenticationRepository,\n child: BlocProvider(\n create: (context) => HomeCubit(_authenticationRepository),\n child: SafeArea(\n child: Scaffold(\n body: Center(\n child: Column(\n children: [\n const Text('HomePage'),\n BlocConsumer(\n listener: (context, state) {\n state.maybeWhen(\n orElse: () {},\n success: () => GoRouter.of(context).go('\/'),\n error: (error) =>\n ScaffoldMessenger.of(context).showSnackBar(\n SnackBar(\n content: Text(error),\n ),\n ),\n );\n },\n builder: (context, state) {\n return state.maybeWhen(\n orElse: () {\n return Button(\n text: 'Log Out',\n onTapped: () => context.read().logOut(),\n );\n },\n loading: () => const Center(\n child: CircularProgressIndicator(),\n ),\n );\n },\n )\n ],\n ),\n ),\n ),\n ),\n ),\n );\n }\n}\n","avg_line_length":34.5223880597,"max_line_length":79,"alphanum_fraction":0.4777345439} {"size":55015,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nimport 'package:test_reflective_loader\/test_reflective_loader.dart';\n\nimport 'abstract_class_member_test.dart' as abstract_class_member;\nimport 'abstract_field_constructor_initializer_test.dart'\n as abstract_field_constructor_initializer;\nimport 'abstract_field_initializer_test.dart' as abstract_field_initializer;\nimport 'abstract_super_member_reference_test.dart'\n as abstract_super_member_reference;\nimport 'access_private_enum_field_test.dart' as access_private_enum_field;\nimport 'ambiguous_export_test.dart' as ambiguous_export;\nimport 'ambiguous_extension_member_access_test.dart'\n as ambiguous_extension_member_access;\nimport 'ambiguous_import_test.dart' as ambiguous_import;\nimport 'ambiguous_set_or_map_literal_test.dart' as ambiguous_set_or_map_literal;\nimport 'annotation_on_pointer_field_test.dart' as annotation_on_pointer_field;\nimport 'annotation_syntax_test.dart' as annotation_syntax;\nimport 'annotation_with_non_class_test.dart' as annotation_with_non_class;\nimport 'argument_type_not_assignable_test.dart' as argument_type_not_assignable;\nimport 'assert_in_redirecting_constructor_test.dart'\n as assert_in_redirecting_constructor;\nimport 'assignment_of_do_not_store_test.dart' as assignment_of_do_not_store;\nimport 'assignment_to_const_test.dart' as assignment_to_const;\nimport 'assignment_to_final_local_test.dart' as assignment_to_final_local;\nimport 'assignment_to_final_no_setter_test.dart'\n as assignment_to_final_no_setter;\nimport 'assignment_to_final_test.dart' as assignment_to_final;\nimport 'assignment_to_function_test.dart' as assignment_to_function;\nimport 'assignment_to_method_test.dart' as assignment_to_method;\nimport 'assignment_to_type_test.dart' as assignment_to_type;\nimport 'async_for_in_wrong_context_test.dart' as async_for_in_wrong_context;\nimport 'async_keyword_used_as_identifier_test.dart'\n as async_keyword_used_as_identifier;\nimport 'await_in_late_local_variable_initializer_test.dart'\n as await_in_late_local_variable_initializer;\nimport 'await_in_wrong_context_test.dart' as await_in_wrong_context;\nimport 'binary_operator_written_out_test.dart' as binary_operator_written_out;\nimport 'body_might_complete_normally_test.dart' as body_might_complete_normally;\nimport 'built_in_identifier_as_extension_name_test.dart'\n as built_in_as_extension_name;\nimport 'built_in_identifier_as_prefix_name_test.dart'\n as built_in_as_prefix_name;\nimport 'built_in_identifier_as_type_name_test.dart' as built_in_as_type_name;\nimport 'built_in_identifier_as_type_parameter_name_test.dart'\n as built_in_as_type_parameter_name;\nimport 'built_in_identifier_as_typedef_name_test.dart'\n as built_in_as_typedef_name;\nimport 'can_be_null_after_null_aware_test.dart' as can_be_null_after_null_aware;\nimport 'case_block_not_terminated_test.dart' as case_block_not_terminated;\nimport 'case_expression_type_implements_equals_test.dart'\n as case_expression_type_implements_equals;\nimport 'case_expression_type_is_not_switch_expression_subtype_test.dart'\n as case_expression_type_is_not_switch_expression_subtype;\nimport 'cast_to_non_type_test.dart' as cast_to_non_type;\nimport 'concrete_class_with_abstract_member_test.dart'\n as concrete_class_with_abstract_member;\nimport 'conflicting_generic_interfaces_test.dart'\n as conflicting_generic_interfaces;\nimport 'conflicting_static_and_instance_test.dart'\n as conflicting_static_and_instance;\nimport 'conflicting_type_variable_and_container_test.dart'\n as conflicting_type_variable_and_container;\nimport 'conflicting_type_variable_and_member_test.dart'\n as conflicting_type_variable_and_member;\nimport 'const_constructor_field_type_mismatch_test.dart'\n as const_constructor_field_type_mismatch;\nimport 'const_constructor_param_type_mismatch_test.dart'\n as const_constructor_param_type_mismatch;\nimport 'const_constructor_with_field_initialized_by_non_const_test.dart'\n as const_constructor_with_field_initialized_by_non_const;\nimport 'const_constructor_with_mixin_with_field_test.dart'\n as const_constructor_with_mixin_with_field;\nimport 'const_constructor_with_non_const_super_test.dart'\n as const_constructor_with_non_const_super;\nimport 'const_constructor_with_non_final_field_test.dart'\n as const_constructor_with_non_final_field;\nimport 'const_deferred_class_test.dart' as const_deferred_class;\nimport 'const_eval_throws_exception_test.dart' as const_eval_throws_exception;\nimport 'const_eval_throws_idbze_test.dart' as const_eval_throws_idbze;\nimport 'const_eval_type_bool_int_test.dart' as const_eval_type_bool_int;\nimport 'const_eval_type_bool_num_string_test.dart'\n as const_eval_type_bool_num_string;\nimport 'const_eval_type_bool_test.dart' as const_eval_type_bool;\nimport 'const_eval_type_num_test.dart' as const_eval_type_num;\nimport 'const_field_initializer_not_assignable_test.dart'\n as const_field_initializer_not_assignable;\nimport 'const_formal_parameter_test.dart' as const_formal_parameter;\nimport 'const_initialized_with_non_constant_value_from_deferred_library_test.dart'\n as const_initialized_with_non_constant_value_from_deferred_library;\nimport 'const_initialized_with_non_constant_value_test.dart'\n as const_initialized_with_non_constant_value;\nimport 'const_instance_field_test.dart' as const_instance_field;\nimport 'const_map_key_expression_type_implements_equals_test.dart'\n as const_map_key_expression_type_implements_equals;\nimport 'const_not_initialized_test.dart' as const_not_initialized;\nimport 'const_set_element_type_implements_equals_test.dart'\n as const_set_element_type_implements_equals;\nimport 'const_spread_expected_list_or_set_test.dart'\n as const_spread_expected_list_or_set;\nimport 'const_spread_expected_map_test.dart' as const_spread_expected_map;\nimport 'const_with_non_const_test.dart' as const_with_non_const;\nimport 'const_with_non_constant_argument_test.dart'\n as const_with_non_constant_argument;\nimport 'const_with_non_type_test.dart' as const_with_non_type;\nimport 'const_with_type_parameters_test.dart' as const_with_type_parameters;\nimport 'const_with_undefined_constructor_test.dart'\n as const_with_undefined_constructor;\nimport 'could_not_infer_test.dart' as could_not_infer;\nimport 'dead_code_test.dart' as dead_code;\nimport 'dead_null_aware_expression_test.dart' as dead_null_aware_expression;\nimport 'default_list_constructor_test.dart' as default_list_constructor;\nimport 'default_value_in_function_type_test.dart'\n as default_value_in_function_type;\nimport 'default_value_in_function_typed_parameter_test.dart'\n as default_value_in_function_typed_parameter;\nimport 'default_value_in_redirecting_factory_constructor_test.dart'\n as default_value_in_redirecting_factory_constructor;\nimport 'default_value_on_required_parameter_test.dart'\n as default_value_on_required_parameter;\nimport 'deferred_import_of_extension_test.dart' as deferred_import_of_extension;\nimport 'definitely_unassigned_late_local_variable_test.dart'\n as definitely_unassigned_late_local_variable;\nimport 'deprecated_extends_function_test.dart' as deprecated_extends_function;\nimport 'deprecated_function_class_declaration_test.dart'\n as deprecated_function_class_declaration;\nimport 'deprecated_member_use_test.dart' as deprecated_member_use;\nimport 'deprecated_mixin_function_test.dart' as deprecated_mixin_function;\nimport 'division_optimization_test.dart' as division_optimization;\nimport 'duplicate_definition_test.dart' as duplicate_definition;\nimport 'duplicate_hidden_name_test.dart' as duplicate_hidden_name;\nimport 'duplicate_import_test.dart' as duplicate_import;\nimport 'duplicate_named_argument_test.dart' as duplicate_named_argument;\nimport 'duplicate_part_test.dart' as duplicate_part;\nimport 'duplicate_shown_name_test.dart' as duplicate_shown_name;\nimport 'enum_constant_same_name_as_enclosing.dart'\n as enum_constant_same_name_as_enclosing;\nimport 'equal_elements_in_const_set_test.dart' as equal_elements_in_const_set;\nimport 'equal_elements_in_set_test.dart' as equal_elements_in_set;\nimport 'equal_keys_in_const_map_test.dart' as equal_keys_in_const_map;\nimport 'equal_keys_in_map_test.dart' as equal_keys_in_map;\nimport 'expected_one_list_type_arguments_test.dart'\n as expected_one_list_type_arguments;\nimport 'expected_one_set_type_arguments_test.dart'\n as expected_one_set_type_arguments;\nimport 'expected_two_map_type_arguments_test.dart'\n as expected_two_map_type_arguments;\nimport 'export_internal_library_test.dart' as export_internal_library;\nimport 'export_legacy_symbol_test.dart' as export_legacy_symbol;\nimport 'export_of_non_library_test.dart' as export_of_non_library;\nimport 'expression_in_map_test.dart' as expression_in_map;\nimport 'extends_deferred_class_test.dart' as extends_deferred_class;\nimport 'extends_disallowed_class_test.dart' as extends_disallowed_class;\nimport 'extends_non_class_test.dart' as extends_non_class;\nimport 'extension_as_expression_test.dart' as extension_as_expression;\nimport 'extension_conflicting_static_and_instance_test.dart'\n as extension_conflicting_static_and_instance;\nimport 'extension_declares_abstract_method_test.dart'\n as extension_declares_abstract_method;\nimport 'extension_declares_constructor_test.dart'\n as extension_declares_constructor;\nimport 'extension_declares_field_test.dart' as extension_declares_field;\nimport 'extension_declares_member_of_object_test.dart'\n as extension_declares_member_of_object;\nimport 'extension_override_access_to_static_member_test.dart'\n as extension_override_access_to_static_member;\nimport 'extension_override_argument_not_assignable_test.dart'\n as extension_override_argument_not_assignable;\nimport 'extension_override_with_cascade_test.dart'\n as extension_override_with_cascade;\nimport 'extension_override_without_access_test.dart'\n as extension_override_without_access;\nimport 'external_field_constructor_initializer_test.dart'\n as external_field_constructor_initializer;\nimport 'external_field_initializer_test.dart' as external_field_initializer;\nimport 'external_variable_initializer_test.dart'\n as external_variable_initializer;\nimport 'extra_annotation_on_struct_field_test.dart'\n as extra_annotation_on_struct_field;\nimport 'extra_positional_arguments_test.dart' as extra_positional_arguments;\nimport 'field_in_struct_with_initializer_test.dart'\n as field_in_struct_with_initializer;\nimport 'field_initialized_by_multiple_initializers_test.dart'\n as field_initialized_by_multiple_initializers;\nimport 'field_initialized_in_initializer_and_declaration_test.dart'\n as field_initialized_in_initializer_and_declaration;\nimport 'field_initialized_in_parameter_and_initializer_test.dart'\n as field_initialized_in_parameter_and_initializer;\nimport 'field_initializer_factory_constructor_test.dart'\n as field_initializer_factory_constructor;\nimport 'field_initializer_in_struct_test.dart' as field_initializer_in_struct;\nimport 'field_initializer_not_assignable_test.dart'\n as field_initializer_not_assignable;\nimport 'field_initializer_outside_constructor_test.dart'\n as field_initializer_outside_constructor;\nimport 'field_initializer_redirecting_constructor_test.dart'\n as field_initializer_redirecting_constructor;\nimport 'field_initializing_formal_not_assignable_test.dart'\n as field_initializing_formal_not_assignable;\nimport 'final_initialized_in_delcaration_and_constructor_test.dart'\n as final_initialized_in_declaration_and_constructor;\nimport 'final_initialized_multiple_times_test.dart'\n as final_initialized_multiple_times;\nimport 'final_not_initialized_constructor_test.dart'\n as final_not_initialized_constructor;\nimport 'final_not_initialized_test.dart' as final_not_initialized;\nimport 'for_in_of_invalid_element_type_test.dart'\n as for_in_of_invalid_element_type;\nimport 'for_in_of_invalid_type_test.dart' as for_in_of_invalid_type;\nimport 'for_in_with_const_variable_test.dart' as for_in_with_const_variable;\nimport 'generic_function_type_cannot_be_bound_test.dart'\n as generic_function_type_cannot_be_bound;\nimport 'generic_struct_subclass_test.dart' as generic_struct_subclass;\nimport 'getter_not_assignable_setter_types_test.dart'\n as getter_not_assignable_setter_types;\nimport 'getter_not_subtype_setter_types_test.dart'\n as getter_not_subtype_setter_types;\nimport 'if_element_condition_from_deferred_library_test.dart'\n as if_element_condition_from_deferred_library;\nimport 'illegal_async_generator_return_type_test.dart'\n as illegal_async_generator_return_type;\nimport 'illegal_async_return_type_test.dart' as illegal_async_return_type;\nimport 'illegal_sync_generator_return_type_test.dart'\n as illegal_sync_generator_return_type;\nimport 'implements_deferred_class_test.dart' as implements_deferred_class;\nimport 'implements_disallowed_class_test.dart' as implements_disallowed_class;\nimport 'implements_non_class_test.dart' as implements_non_class;\nimport 'implements_super_class_test.dart' as implements_super_class;\nimport 'implicit_this_reference_in_initializer_test.dart'\n as implicit_this_reference_in_initializer;\nimport 'import_deferred_library_with_load_function_test.dart'\n as import_deferred_library_with_load_function;\nimport 'import_internal_library_test.dart' as import_internal_library;\nimport 'import_of_non_library_test.dart' as import_of_non_library;\nimport 'inconsistent_case_expression_types_test.dart'\n as inconsistent_case_expression_types;\nimport 'inconsistent_inheritance_getter_and_method_test.dart'\n as inconsistent_inheritance_getter_and_method;\nimport 'inconsistent_inheritance_test.dart' as inconsistent_inheritance;\nimport 'inconsistent_language_version_override_test.dart'\n as inconsistent_language_version_override;\nimport 'inference_failure_on_collection_literal_test.dart'\n as inference_failure_on_collection_literal;\nimport 'inference_failure_on_function_return_type_test.dart'\n as inference_failure_on_function_return_type;\nimport 'inference_failure_on_instance_creation_test.dart'\n as inference_failure_on_instance_creation;\nimport 'inference_failure_on_uninitialized_variable_test.dart'\n as inference_failure_on_uninitialized_variable;\nimport 'inference_failure_on_untyped_parameter_test.dart'\n as inference_failure_on_untyped_parameter;\nimport 'initializer_for_non_existent_field_test.dart'\n as initializer_for_non_existent_field;\nimport 'initializer_for_static_field_test.dart' as initializer_for_static_field;\nimport 'initializing_formal_for_non_existent_field_test.dart'\n as initializing_formal_for_non_existent_field;\nimport 'initializing_formal_for_static_field_test.dart'\n as initializing_formal_for_static_field;\nimport 'instance_access_to_static_member_test.dart'\n as instance_access_to_static_member;\nimport 'instance_member_access_from_factory_test.dart'\n as instance_member_access_from_factory;\nimport 'instance_member_access_from_static_test.dart'\n as instance_member_access_from_static;\nimport 'instantiate_abstract_class_test.dart' as instantiate_abstract_class;\nimport 'instantiate_enum_test.dart' as instantiate_enum;\nimport 'integer_literal_imprecise_as_double_test.dart'\n as integer_literal_imprecise_as_double;\nimport 'integer_literal_out_of_range_test.dart' as integer_literal_out_of_range;\nimport 'invalid_annotation_from_deferred_library_test.dart'\n as invalid_annotation_from_deferred_library;\nimport 'invalid_annotation_getter_test.dart' as invalid_annotation_getter;\nimport 'invalid_annotation_target_test.dart' as invalid_annotation_target;\nimport 'invalid_annotation_test.dart' as invalid_annotation;\nimport 'invalid_assignment_test.dart' as invalid_assignment;\nimport 'invalid_cast_new_expr_test.dart' as invalid_cast_new_expr;\nimport 'invalid_constant_test.dart' as invalid_constant;\nimport 'invalid_constructor_name_test.dart' as invalid_constructor_name;\nimport 'invalid_exception_value_test.dart' as invalid_exception_value;\nimport 'invalid_extension_argument_count_test.dart'\n as invalid_extension_argument_count;\nimport 'invalid_factory_annotation_test.dart' as invalid_factory_annotation;\nimport 'invalid_factory_method_impl_test.dart' as invalid_factory_method_impl;\nimport 'invalid_factory_name_not_a_class_test.dart'\n as invalid_factory_name_not_a_class;\nimport 'invalid_field_type_in_struct_test.dart' as invalid_field_type_in_struct;\nimport 'invalid_immutable_annotation_test.dart' as invalid_immutable_annotation;\nimport 'invalid_language_override_greater_test.dart'\n as invalid_language_override_greater;\nimport 'invalid_language_override_test.dart' as invalid_language_override;\nimport 'invalid_literal_annotation_test.dart' as invalid_literal_annotation;\nimport 'invalid_modifier_on_constructor_test.dart'\n as invalid_modifier_on_constructor;\nimport 'invalid_modifier_on_setter_test.dart' as invalid_modifier_on_setter;\nimport 'invalid_non_virtual_annotation_test.dart'\n as invalid_non_virtual_annotation;\nimport 'invalid_null_aware_operator_test.dart' as invalid_null_aware_operator;\nimport 'invalid_override_different_default_values_named_test.dart'\n as invalid_override_different_default_values_named;\nimport 'invalid_override_different_default_values_positional_test.dart'\n as invalid_override_different_default_values_positional;\nimport 'invalid_override_of_non_virtual_member_test.dart'\n as invalid_override_of_non_virtual_member;\nimport 'invalid_override_test.dart' as invalid_override;\nimport 'invalid_reference_to_this_test.dart' as invalid_reference_to_this;\nimport 'invalid_required_named_param_test.dart' as invalid_required_named_param;\nimport 'invalid_required_optional_positional_param_test.dart'\n as invalid_required_optional_positional_param;\nimport 'invalid_required_positional_param_test.dart'\n as invalid_required_positional_param;\nimport 'invalid_sealed_annotation_test.dart' as invalid_sealed_annotation;\nimport 'invalid_super_invocation_test.dart' as invalid_super_invocation;\nimport 'invalid_type_argument_in_const_list_test.dart'\n as invalid_type_argument_in_const_list;\nimport 'invalid_type_argument_in_const_map_test.dart'\n as invalid_type_argument_in_const_map;\nimport 'invalid_type_argument_in_const_set_test.dart'\n as invalid_type_argument_in_const_set;\nimport 'invalid_uri_test.dart' as invalid_uri;\nimport 'invalid_use_of_covariant_in_extension_test.dart'\n as invalid_use_of_covariant_in_extension;\nimport 'invalid_use_of_protected_member_test.dart'\n as invalid_use_of_protected_member;\nimport 'invalid_use_of_visible_for_template_member_test.dart'\n as invalid_use_of_visible_for_template_member;\nimport 'invalid_use_of_visible_for_testing_member_test.dart'\n as invalid_use_of_visible_for_testing_member;\nimport 'invalid_visibility_annotation_test.dart'\n as invalid_visibility_annotation;\nimport 'invocation_of_extension_without_call_test.dart'\n as invocation_of_extension_without_call;\nimport 'invocation_of_non_function_expression_test.dart'\n as invocation_of_non_function_expression;\nimport 'label_in_outer_scope_test.dart' as label_in_outer_scope;\nimport 'label_undefined_test.dart' as label_undefined;\nimport 'late_final_field_with_const_constructor_test.dart'\n as late_final_field_with_const_constructor;\nimport 'late_final_local_already_assigned_test.dart'\n as late_final_local_already_assigned;\nimport 'list_element_type_not_assignable_test.dart'\n as list_element_type_not_assignable;\nimport 'map_entry_not_in_map_test.dart' as map_entry_not_in_map;\nimport 'map_key_type_not_assignable_test.dart' as map_key_type_not_assignable;\nimport 'map_value_type_not_assignable_test.dart'\n as map_value_type_not_assignable;\nimport 'member_with_class_name_test.dart' as member_with_class_name;\nimport 'mismatched_annotation_on_struct_field_test.dart'\n as mismatched_annotation_on_struct_field;\nimport 'missing_annotation_on_struct_field_test.dart'\n as missing_annotation_on_struct_field;\nimport 'missing_default_value_for_parameter_test.dart'\n as missing_default_value_for_parameter;\nimport 'missing_enum_constant_in_switch_test.dart'\n as missing_enum_constant_in_switch;\nimport 'missing_exception_value_test.dart' as missing_exception_value;\nimport 'missing_field_type_in_struct_test.dart' as missing_field_type_in_struct;\nimport 'missing_js_lib_annotation_test.dart' as missing_js_lib_annotation;\nimport 'missing_required_param_test.dart' as missing_required_param;\nimport 'missing_return_test.dart' as missing_return;\nimport 'mixin_application_not_implemented_interface_test.dart'\n as mixin_application_not_implemented_interface;\nimport 'mixin_class_declares_constructor_test.dart'\n as mixin_class_declares_constructor;\nimport 'mixin_declares_constructor_test.dart' as mixin_declares_constructor;\nimport 'mixin_deferred_class_test.dart' as mixin_deferred_class;\nimport 'mixin_inference_no_possible_substitution_test.dart'\n as mixin_inference_no_possible_substitution;\nimport 'mixin_inherits_from_not_object_test.dart'\n as mixin_inherits_from_not_object;\nimport 'mixin_of_disallowed_class_test.dart' as mixin_of_disallowed_class;\nimport 'mixin_of_non_class_test.dart' as mixin_of_non_class;\nimport 'mixin_on_sealed_class_test.dart' as mixin_on_sealed_class;\nimport 'mixin_super_class_constraint_non_interface_test.dart'\n as mixin_super_class_constraint_non_interface;\nimport 'mixin_with_non_class_superclass_test.dart'\n as mixin_with_non_class_superclass;\nimport 'mixins_super_class_test.dart' as mixins_super_class;\nimport 'multiple_redirecting_constructor_invocations_test.dart'\n as multiple_redirecting_constructor_invocations;\nimport 'multiple_super_initializers_test.dart' as multiple_super_initializers;\nimport 'must_be_a_native_function_type_test.dart'\n as must_be_a_native_function_type;\nimport 'must_be_a_subtype_test.dart' as must_be_a_subtype;\nimport 'must_be_immutable_test.dart' as must_be_immutable;\nimport 'must_call_super_test.dart' as must_call_super;\nimport 'native_clause_in_non_sdk_code_test.dart'\n as native_clause_in_non_sdk_code;\nimport 'native_function_body_in_non_sdk_code_test.dart'\n as native_function_body_in_non_sdk_code;\nimport 'new_with_non_type_test.dart' as new_with_non_type;\nimport 'new_with_undefined_constructor_test.dart'\n as new_with_undefined_constructor;\nimport 'no_annotation_constructor_arguments_test.dart'\n as no_annotation_constructor_arguments;\nimport 'no_combined_super_signature_test.dart' as no_combined_super_signature;\nimport 'no_default_super_constructor_test.dart' as no_default_super_constructor;\nimport 'no_generative_constructors_in_superclass_test.dart'\n as no_generative_constructors_in_superclass;\nimport 'non_abstract_class_inherits_abstract_member_test.dart'\n as non_abstract_class_inherits_abstract_member;\nimport 'non_bool_condition_test.dart' as non_bool_condition;\nimport 'non_bool_expression_test.dart' as non_bool_expression;\nimport 'non_bool_negation_expression_test.dart' as non_bool_negation_expression;\nimport 'non_bool_operand_test.dart' as non_bool_operand;\nimport 'non_const_call_to_literal_constructor_test.dart'\n as non_const_call_to_literal_constructor;\nimport 'non_const_map_as_expression_statement_test.dart'\n as non_const_map_as_expression_statement;\nimport 'non_constant_annotation_constructor_test.dart'\n as non_constant_annotation_constructor;\nimport 'non_constant_case_expression_from_deferred_library_test.dart'\n as non_constant_case_expression_from_deferred_library;\nimport 'non_constant_case_expression_test.dart' as non_constant_case_expression;\nimport 'non_constant_default_value_from_deferred_library_test.dart'\n as non_constant_default_value_from_deferred_library;\nimport 'non_constant_default_value_test.dart' as non_constant_default_value;\nimport 'non_constant_list_element_from_deferred_library_test.dart'\n as non_constant_list_element_from_deferred_library;\nimport 'non_constant_list_element_test.dart' as non_constant_list_element;\nimport 'non_constant_map_element_test.dart' as non_constant_map_element;\nimport 'non_constant_map_key_from_deferred_library_test.dart'\n as non_constant_map_key_from_deferred_library;\nimport 'non_constant_map_key_test.dart' as non_constant_map_key;\nimport 'non_constant_map_value_from_deferred_library_test.dart'\n as non_constant_map_value_from_deferred_library;\nimport 'non_constant_map_value_test.dart' as non_constant_map_value;\nimport 'non_constant_set_element_test.dart' as non_constant_set_element;\nimport 'non_constant_type_argument_test.dart' as non_constant_type_argument;\nimport 'non_generative_constructor_test.dart' as non_generative_constructor;\nimport 'non_generative_implicit_constructor_test.dart'\n as non_generative_implicit_constructor;\nimport 'non_native_function_type_argument_to_pointer_test.dart'\n as non_native_function_type_argument_to_pointer;\nimport 'non_null_opt_out_test.dart' as non_null_opt_out;\nimport 'non_type_as_type_argument_test.dart' as non_type_as_type_argument;\nimport 'non_type_in_catch_clause_test.dart' as non_type_in_catch_clause;\nimport 'non_void_return_for_operator_test.dart' as non_void_return_for_operator;\nimport 'non_void_return_for_setter_test.dart' as non_void_return_for_setter;\nimport 'not_a_type_test.dart' as not_a_type;\nimport 'not_assigned_potentially_non_nullable_local_variable_test.dart'\n as not_assigned_potentially_non_nullable_local_variable;\nimport 'not_enough_positional_arguments_test.dart'\n as not_enough_positional_arguments;\nimport 'not_initialized_non_nullable_instance_field_test.dart'\n as not_initialized_non_nullable_instance_field;\nimport 'not_initialized_non_nullable_variable_test.dart'\n as not_initialized_non_nullable_variable;\nimport 'not_instantiated_bound_test.dart' as not_instantiated_bound;\nimport 'not_iterable_spread_test.dart' as not_iterable_spread;\nimport 'not_map_spread_test.dart' as not_map_spread;\nimport 'not_null_aware_null_spread_test.dart' as not_null_aware_null_spread;\nimport 'null_aware_before_operator_test.dart' as null_aware_before_operator;\nimport 'null_aware_in_condition_test.dart' as null_aware_in_condition;\nimport 'null_aware_in_logical_operator_test.dart'\n as null_aware_in_logical_operator;\nimport 'null_safety_read_write_test.dart' as null_safety_read_write;\nimport 'nullable_type_in_catch_clause_test.dart'\n as nullable_type_in_catch_clause;\nimport 'nullable_type_in_extends_clause_test.dart'\n as nullable_type_in_extends_clause;\nimport 'nullable_type_in_implements_clause_test.dart'\n as nullable_type_in_implements_clause;\nimport 'nullable_type_in_on_clause_test.dart' as nullable_type_in_on_clause;\nimport 'nullable_type_in_with_clause_test.dart' as nullable_type_in_with_clause;\nimport 'object_cannot_extend_another_class_test.dart'\n as object_cannot_extend_another_class;\nimport 'optional_parameter_in_operator_test.dart'\n as optional_parameter_in_operator;\nimport 'override_equals_but_not_hashcode_test.dart'\n as override_equals_but_not_hashcode;\nimport 'override_on_non_overriding_field_test.dart'\n as override_on_non_overriding_field;\nimport 'override_on_non_overriding_getter_test.dart'\n as override_on_non_overriding_getter;\nimport 'override_on_non_overriding_method_test.dart'\n as override_on_non_overriding_method;\nimport 'override_on_non_overriding_setter_test.dart'\n as override_on_non_overriding_setter;\nimport 'part_of_different_library_test.dart' as part_of_different_library;\nimport 'part_of_non_part_test.dart' as part_of_non_part;\nimport 'prefix_collides_with_top_level_member_test.dart'\n as prefix_collides_with_top_level_member;\nimport 'prefix_identifier_not_followed_by_dot_test.dart'\n as prefix_identifier_not_followed_by_dot;\nimport 'prefix_shadowed_by_local_declaration_test.dart'\n as prefix_shadowed_by_local_declaration;\nimport 'private_collision_in_mixin_application_test.dart'\n as private_collision_in_mixin_application;\nimport 'private_optional_parameter_test.dart' as private_optional_parameter;\nimport 'private_setter_test.dart' as private_setter;\nimport 'receiver_of_type_never_test.dart' as receiver_of_type_never;\nimport 'recursive_compile_time_constant_test.dart'\n as recursive_compile_time_constant;\nimport 'recursive_constructor_redirect_test.dart'\n as recursive_constructor_redirect;\nimport 'recursive_factory_redirect_test.dart' as recursive_factory_redirect;\nimport 'recursive_interface_inheritance_test.dart'\n as recursive_interface_inheritance;\nimport 'redirect_generative_to_missing_constructor_test.dart'\n as redirect_generative_to_missing_constructor;\nimport 'redirect_generative_to_non_generative_constructor_test.dart'\n as redirect_generative_to_non_generative_constructor;\nimport 'redirect_to_abstract_class_constructor_test.dart'\n as redirect_to_abstract_class_constructor;\nimport 'redirect_to_invalid_function_type_test.dart'\n as redirect_to_invalid_function_type;\nimport 'redirect_to_invalid_return_type_test.dart'\n as redirect_to_invalid_return_type;\nimport 'redirect_to_missing_constructor_test.dart'\n as redirect_to_missing_constructor;\nimport 'redirect_to_non_class_test.dart' as redirect_to_non_class;\nimport 'redirect_to_non_const_constructor_test.dart'\n as redirect_to_non_const_constructor;\nimport 'referenced_before_declaration_test.dart'\n as referenced_before_declaration;\nimport 'rethrow_outside_catch_test.dart' as rethrow_outside_catch;\nimport 'return_in_generative_constructor_test.dart'\n as return_in_generative_constructor;\nimport 'return_in_generator_test.dart' as return_in_generator;\nimport 'return_of_do_not_store_test.dart' as return_of_do_not_store;\nimport 'return_of_invalid_type_test.dart' as return_of_invalid_type;\nimport 'return_without_value_test.dart' as return_without_value;\nimport 'sdk_version_as_expression_in_const_context_test.dart'\n as sdk_version_as_expression_in_const_context;\nimport 'sdk_version_async_exported_from_core_test.dart'\n as sdk_version_async_exported_from_core;\nimport 'sdk_version_bool_operator_in_const_context_test.dart'\n as sdk_version_bool_operator_in_const_context;\nimport 'sdk_version_eq_eq_operator_test.dart' as sdk_version_eq_eq_operator;\nimport 'sdk_version_extension_methods_test.dart'\n as sdk_version_extension_methods;\nimport 'sdk_version_gt_gt_gt_operator_test.dart'\n as sdk_version_gt_gt_gt_operator;\nimport 'sdk_version_is_expression_in_const_context_test.dart'\n as sdk_version_is_expression_in_const_context;\nimport 'sdk_version_never_test.dart' as sdk_version_never;\nimport 'sdk_version_set_literal_test.dart' as sdk_version_set_literal;\nimport 'sdk_version_ui_as_code_in_const_context_test.dart'\n as sdk_version_ui_as_code_in_const_context;\nimport 'sdk_version_ui_as_code_test.dart' as sdk_version_ui_as_code;\nimport 'set_element_from_deferred_library_test.dart'\n as set_element_from_deferred_library;\nimport 'set_element_type_not_assignable_test.dart'\n as set_element_type_not_assignable;\nimport 'shared_deferred_prefix_test.dart' as shared_deferred_prefix;\nimport 'spread_expression_from_deferred_library_test.dart'\n as spread_expression_from_deferred_library;\nimport 'static_access_to_instance_member_test.dart'\n as static_access_to_instance_member;\nimport 'strict_raw_type_test.dart' as strict_raw_type;\nimport 'subtype_of_ffi_class_test.dart' as subtype_of_ffi_class;\nimport 'subtype_of_sealed_class_test.dart' as subtype_of_sealed_class;\nimport 'subtype_of_struct_class_test.dart' as subtype_of_struct_class;\nimport 'super_in_extension_test.dart' as super_in_extension;\nimport 'super_in_invalid_context_test.dart' as super_in_invalid_context;\nimport 'super_in_redirecting_constructor_test.dart'\n as super_in_redirecting_constructor;\nimport 'super_initializer_in_object_test.dart' as super_initializer_in_object;\nimport 'switch_case_completes_normally_test.dart'\n as switch_case_completes_normally;\nimport 'switch_expression_not_assignable_test.dart'\n as switch_expression_not_assignable;\nimport 'throw_of_invalid_type_test.dart' as throw_of_invalid_type;\nimport 'todo_test.dart' as todo_test;\nimport 'top_level_cycle_test.dart' as top_level_cycle;\nimport 'top_level_instance_getter_test.dart' as top_level_instance_getter;\nimport 'top_level_instance_method_test.dart' as top_level_instance_method;\nimport 'type_alias_cannot_reference_itself_test.dart'\n as type_alias_cannot_reference_itself;\nimport 'type_annotation_deferred_class_test.dart'\n as type_annotation_deferred_class;\nimport 'type_argument_not_matching_bounds_test.dart'\n as type_argument_not_matching_bounds;\nimport 'type_check_is_not_null_test.dart' as type_check_is_not_null;\nimport 'type_check_is_null_test.dart' as type_check_is_null;\nimport 'type_parameter_referenced_by_static_test.dart'\n as type_parameter_referenced_by_static;\nimport 'type_parameter_supertype_of_its_bound_test.dart'\n as type_parameter_supertype_of_its_bound;\nimport 'type_test_with_non_type_test.dart' as type_test_with_non_type;\nimport 'type_test_with_undefined_name_test.dart'\n as type_test_with_undefined_name;\nimport 'undefined_annotation_test.dart' as undefined_annotation;\nimport 'undefined_class_boolean_test.dart' as undefined_class_boolean;\nimport 'undefined_class_test.dart' as undefined_class;\nimport 'undefined_constructor_in_initializer_default_test.dart'\n as undefined_constructor_in_initializer_default;\nimport 'undefined_constructor_in_initializer_test.dart'\n as undefined_constructor_in_initializer;\nimport 'undefined_enum_constant_test.dart' as undefined_enum_constant;\nimport 'undefined_extension_getter_test.dart' as undefined_extension_getter;\nimport 'undefined_extension_method_test.dart' as undefined_extension_method;\nimport 'undefined_extension_operator_test.dart' as undefined_extension_operator;\nimport 'undefined_extension_setter_test.dart' as undefined_extension_setter;\nimport 'undefined_getter_test.dart' as undefined_getter;\nimport 'undefined_hidden_name_test.dart' as undefined_hidden_name;\nimport 'undefined_identifier_await_test.dart' as undefined_identifier_await;\nimport 'undefined_identifier_test.dart' as undefined_identifier;\nimport 'undefined_method_test.dart' as undefined_method;\nimport 'undefined_named_parameter_test.dart' as undefined_named_parameter;\nimport 'undefined_operator_test.dart' as undefined_operator;\nimport 'undefined_prefixed_name_test.dart' as undefined_prefixed_name;\nimport 'undefined_setter_test.dart' as undefined_setter;\nimport 'undefined_shown_name_test.dart' as undefined_shown_name;\nimport 'unnecessary_cast_test.dart' as unnecessary_cast;\nimport 'unnecessary_no_such_method_test.dart' as unnecessary_no_such_method;\nimport 'unnecessary_non_null_assertion_test.dart'\n as unnecessary_non_null_assertion;\nimport 'unnecessary_null_comparison_test.dart' as unnecessary_null_comparison;\nimport 'unnecessary_type_check_test.dart' as unnecessary_type_check;\nimport 'unqualified_reference_to_non_local_static_member_test.dart'\n as unqualified_reference_to_non_local_static_member;\nimport 'unqualified_reference_to_static_member_of_extended_type_test.dart'\n as unqualified_reference_to_static_member_of_extended_type;\nimport 'unused_catch_clause_test.dart' as unused_catch_clause;\nimport 'unused_catch_stack_test.dart' as unused_catch_stack;\nimport 'unused_element_test.dart' as unused_element;\nimport 'unused_field_test.dart' as unused_field;\nimport 'unused_import_test.dart' as unused_import;\nimport 'unused_label_test.dart' as unused_label;\nimport 'unused_local_variable_test.dart' as unused_local_variable;\nimport 'unused_shown_name_test.dart' as unused_shown_name;\nimport 'uri_does_not_exist_test.dart' as uri_does_not_exist;\nimport 'uri_with_interpolation_test.dart' as uri_with_interpolation;\nimport 'use_of_nullable_value_test.dart' as use_of_nullable_value_test;\nimport 'use_of_void_result_test.dart' as use_of_void_result;\nimport 'variable_type_mismatch_test.dart' as variable_type_mismatch;\nimport 'void_with_type_arguments_test.dart' as void_with_type_arguments_test;\nimport 'wrong_number_of_parameters_for_operator_test.dart'\n as wrong_number_of_parameters_for_operator;\nimport 'wrong_number_of_parameters_for_setter_test.dart'\n as wrong_number_of_parameters_for_setter;\nimport 'wrong_number_of_type_arguments_extension_test.dart'\n as wrong_number_of_type_arguments_extension;\nimport 'wrong_number_of_type_arguments_test.dart'\n as wrong_number_of_type_arguments;\nimport 'wrong_type_parameter_variance_in_superinterface_test.dart'\n as wrong_type_parameter_variance_in_superinterface;\nimport 'yield_each_in_non_generator_test.dart' as yield_each_in_non_generator;\nimport 'yield_in_non_generator_test.dart' as yield_in_non_generator;\nimport 'yield_of_invalid_type_test.dart' as yield_of_invalid_type;\n\nmain() {\n defineReflectiveSuite(() {\n abstract_class_member.main();\n abstract_field_constructor_initializer.main();\n abstract_field_initializer.main();\n abstract_super_member_reference.main();\n access_private_enum_field.main();\n ambiguous_export.main();\n ambiguous_extension_member_access.main();\n ambiguous_import.main();\n ambiguous_set_or_map_literal.main();\n annotation_on_pointer_field.main();\n annotation_syntax.main();\n annotation_with_non_class.main();\n argument_type_not_assignable.main();\n assert_in_redirecting_constructor.main();\n assignment_of_do_not_store.main();\n assignment_to_const.main();\n assignment_to_final_local.main();\n assignment_to_final_no_setter.main();\n assignment_to_final.main();\n assignment_to_function.main();\n assignment_to_method.main();\n assignment_to_type.main();\n async_for_in_wrong_context.main();\n async_keyword_used_as_identifier.main();\n await_in_late_local_variable_initializer.main();\n await_in_wrong_context.main();\n binary_operator_written_out.main();\n body_might_complete_normally.main();\n built_in_as_extension_name.main();\n built_in_as_prefix_name.main();\n built_in_as_type_name.main();\n built_in_as_type_parameter_name.main();\n built_in_as_typedef_name.main();\n can_be_null_after_null_aware.main();\n case_block_not_terminated.main();\n case_expression_type_implements_equals.main();\n case_expression_type_is_not_switch_expression_subtype.main();\n cast_to_non_type.main();\n concrete_class_with_abstract_member.main();\n conflicting_generic_interfaces.main();\n conflicting_static_and_instance.main();\n conflicting_type_variable_and_container.main();\n conflicting_type_variable_and_member.main();\n const_constructor_field_type_mismatch.main();\n const_constructor_param_type_mismatch.main();\n const_constructor_with_field_initialized_by_non_const.main();\n const_constructor_with_mixin_with_field.main();\n const_constructor_with_non_const_super.main();\n const_constructor_with_non_final_field.main();\n const_deferred_class.main();\n const_eval_throws_exception.main();\n const_eval_throws_idbze.main();\n const_eval_type_bool_int.main();\n const_eval_type_bool_num_string.main();\n const_eval_type_bool.main();\n const_eval_type_num.main();\n const_field_initializer_not_assignable.main();\n const_formal_parameter.main();\n const_initialized_with_non_constant_value_from_deferred_library.main();\n const_initialized_with_non_constant_value.main();\n const_instance_field.main();\n const_map_key_expression_type_implements_equals.main();\n const_not_initialized.main();\n const_set_element_type_implements_equals.main();\n const_spread_expected_list_or_set.main();\n const_spread_expected_map.main();\n const_with_non_const.main();\n const_with_non_constant_argument.main();\n const_with_non_type.main();\n const_with_type_parameters.main();\n const_with_undefined_constructor.main();\n could_not_infer.main();\n dead_code.main();\n dead_null_aware_expression.main();\n default_list_constructor.main();\n default_value_in_function_type.main();\n default_value_in_function_typed_parameter.main();\n default_value_in_redirecting_factory_constructor.main();\n default_value_on_required_parameter.main();\n deferred_import_of_extension.main();\n definitely_unassigned_late_local_variable.main();\n deprecated_extends_function.main();\n deprecated_function_class_declaration.main();\n deprecated_member_use.main();\n deprecated_mixin_function.main();\n division_optimization.main();\n duplicate_definition.main();\n duplicate_hidden_name.main();\n duplicate_import.main();\n duplicate_named_argument.main();\n duplicate_part.main();\n duplicate_shown_name.main();\n enum_constant_same_name_as_enclosing.main();\n equal_elements_in_const_set.main();\n equal_elements_in_set.main();\n equal_keys_in_const_map.main();\n equal_keys_in_map.main();\n expected_one_list_type_arguments.main();\n expected_one_set_type_arguments.main();\n expected_two_map_type_arguments.main();\n export_internal_library.main();\n export_legacy_symbol.main();\n export_of_non_library.main();\n expression_in_map.main();\n extends_deferred_class.main();\n extends_disallowed_class.main();\n extends_non_class.main();\n extension_as_expression.main();\n extension_conflicting_static_and_instance.main();\n extension_declares_abstract_method.main();\n extension_declares_constructor.main();\n extension_declares_field.main();\n extension_declares_member_of_object.main();\n extension_override_access_to_static_member.main();\n extension_override_argument_not_assignable.main();\n extension_override_with_cascade.main();\n extension_override_without_access.main();\n external_field_constructor_initializer.main();\n external_field_initializer.main();\n external_variable_initializer.main();\n extra_annotation_on_struct_field.main();\n extra_positional_arguments.main();\n field_in_struct_with_initializer.main();\n field_initialized_by_multiple_initializers.main();\n final_initialized_in_declaration_and_constructor.main();\n field_initialized_in_initializer_and_declaration.main();\n field_initialized_in_parameter_and_initializer.main();\n final_initialized_multiple_times.main();\n field_initializer_factory_constructor.main();\n field_initializer_in_struct.main();\n field_initializer_not_assignable.main();\n field_initializer_outside_constructor.main();\n field_initializer_redirecting_constructor.main();\n field_initializing_formal_not_assignable.main();\n final_not_initialized_constructor.main();\n final_not_initialized.main();\n for_in_of_invalid_element_type.main();\n for_in_of_invalid_type.main();\n for_in_with_const_variable.main();\n generic_function_type_cannot_be_bound.main();\n generic_struct_subclass.main();\n getter_not_assignable_setter_types.main();\n getter_not_subtype_setter_types.main();\n if_element_condition_from_deferred_library.main();\n illegal_async_generator_return_type.main();\n illegal_async_return_type.main();\n illegal_sync_generator_return_type.main();\n implements_deferred_class.main();\n implements_disallowed_class.main();\n implements_non_class.main();\n implements_super_class.main();\n implicit_this_reference_in_initializer.main();\n import_deferred_library_with_load_function.main();\n import_internal_library.main();\n import_of_non_library.main();\n inconsistent_case_expression_types.main();\n inconsistent_inheritance_getter_and_method.main();\n inconsistent_inheritance.main();\n inconsistent_language_version_override.main();\n inference_failure_on_collection_literal.main();\n inference_failure_on_function_return_type.main();\n inference_failure_on_instance_creation.main();\n inference_failure_on_uninitialized_variable.main();\n inference_failure_on_untyped_parameter.main();\n initializer_for_non_existent_field.main();\n initializer_for_static_field.main();\n initializing_formal_for_non_existent_field.main();\n initializing_formal_for_static_field.main();\n instance_access_to_static_member.main();\n instance_member_access_from_factory.main();\n instance_member_access_from_static.main();\n instantiate_abstract_class.main();\n instantiate_enum.main();\n integer_literal_imprecise_as_double.main();\n integer_literal_out_of_range.main();\n invalid_annotation.main();\n invalid_annotation_from_deferred_library.main();\n invalid_annotation_getter.main();\n invalid_annotation_target.main();\n invalid_assignment.main();\n invalid_cast_new_expr.main();\n invalid_constant.main();\n invalid_constructor_name.main();\n invalid_exception_value.main();\n invalid_extension_argument_count.main();\n invalid_factory_annotation.main();\n invalid_factory_method_impl.main();\n invalid_factory_name_not_a_class.main();\n invalid_field_type_in_struct.main();\n invalid_immutable_annotation.main();\n invalid_language_override_greater.main();\n invalid_language_override.main();\n invalid_literal_annotation.main();\n invalid_modifier_on_constructor.main();\n invalid_modifier_on_setter.main();\n invalid_non_virtual_annotation.main();\n invalid_null_aware_operator.main();\n invalid_override_different_default_values_named.main();\n invalid_override_different_default_values_positional.main();\n invalid_override_of_non_virtual_member.main();\n invalid_override.main();\n invalid_reference_to_this.main();\n invalid_required_named_param.main();\n invalid_required_optional_positional_param.main();\n invalid_required_positional_param.main();\n invalid_sealed_annotation.main();\n invalid_super_invocation.main();\n invalid_type_argument_in_const_list.main();\n invalid_type_argument_in_const_map.main();\n invalid_type_argument_in_const_set.main();\n invalid_uri.main();\n invalid_use_of_covariant_in_extension.main();\n invalid_use_of_protected_member.main();\n invalid_use_of_visible_for_template_member.main();\n invalid_use_of_visible_for_testing_member.main();\n invalid_visibility_annotation.main();\n invocation_of_extension_without_call.main();\n invocation_of_non_function_expression.main();\n label_in_outer_scope.main();\n label_undefined.main();\n late_final_field_with_const_constructor.main();\n late_final_local_already_assigned.main();\n list_element_type_not_assignable.main();\n map_entry_not_in_map.main();\n map_key_type_not_assignable.main();\n map_value_type_not_assignable.main();\n member_with_class_name.main();\n mismatched_annotation_on_struct_field.main();\n missing_annotation_on_struct_field.main();\n missing_default_value_for_parameter.main();\n missing_enum_constant_in_switch.main();\n missing_exception_value.main();\n missing_field_type_in_struct.main();\n missing_js_lib_annotation.main();\n missing_required_param.main();\n missing_return.main();\n mixin_application_not_implemented_interface.main();\n mixin_class_declares_constructor.main();\n mixin_declares_constructor.main();\n mixin_deferred_class.main();\n mixin_inference_no_possible_substitution.main();\n mixin_inherits_from_not_object.main();\n mixin_of_disallowed_class.main();\n mixin_of_non_class.main();\n mixin_on_sealed_class.main();\n mixin_super_class_constraint_non_interface.main();\n mixin_with_non_class_superclass.main();\n mixins_super_class.main();\n multiple_redirecting_constructor_invocations.main();\n multiple_super_initializers.main();\n must_be_a_native_function_type.main();\n must_be_a_subtype.main();\n must_be_immutable.main();\n must_call_super.main();\n native_clause_in_non_sdk_code.main();\n native_function_body_in_non_sdk_code.main();\n new_with_non_type.main();\n new_with_undefined_constructor.main();\n no_annotation_constructor_arguments.main();\n no_combined_super_signature.main();\n no_default_super_constructor.main();\n no_generative_constructors_in_superclass.main();\n non_abstract_class_inherits_abstract_member.main();\n non_bool_condition.main();\n non_bool_expression.main();\n non_bool_negation_expression.main();\n non_bool_operand.main();\n non_constant_annotation_constructor.main();\n non_constant_list_element.main();\n non_constant_case_expression_from_deferred_library.main();\n non_constant_case_expression.main();\n non_constant_default_value_from_deferred_library.main();\n non_constant_default_value.main();\n non_constant_list_element_from_deferred_library.main();\n non_constant_map_key.main();\n non_constant_map_key_from_deferred_library.main();\n non_constant_map_element.main();\n non_constant_map_value.main();\n non_constant_map_value_from_deferred_library.main();\n non_constant_set_element.main();\n non_constant_type_argument.main();\n non_generative_constructor.main();\n non_generative_implicit_constructor.main();\n non_native_function_type_argument_to_pointer.main();\n non_null_opt_out.main();\n non_type_as_type_argument.main();\n non_type_in_catch_clause.main();\n non_void_return_for_operator.main();\n non_void_return_for_setter.main();\n not_a_type.main();\n not_assigned_potentially_non_nullable_local_variable.main();\n non_const_call_to_literal_constructor.main();\n non_const_map_as_expression_statement.main();\n not_enough_positional_arguments.main();\n not_initialized_non_nullable_instance_field.main();\n not_initialized_non_nullable_variable.main();\n not_instantiated_bound.main();\n not_iterable_spread.main();\n not_map_spread.main();\n not_null_aware_null_spread.main();\n null_aware_before_operator.main();\n null_aware_in_condition.main();\n null_aware_in_logical_operator.main();\n null_safety_read_write.main();\n nullable_type_in_catch_clause.main();\n nullable_type_in_extends_clause.main();\n nullable_type_in_implements_clause.main();\n nullable_type_in_on_clause.main();\n nullable_type_in_with_clause.main();\n object_cannot_extend_another_class.main();\n optional_parameter_in_operator.main();\n override_equals_but_not_hashcode.main();\n override_on_non_overriding_field.main();\n override_on_non_overriding_getter.main();\n override_on_non_overriding_method.main();\n override_on_non_overriding_setter.main();\n part_of_different_library.main();\n part_of_non_part.main();\n prefix_collides_with_top_level_member.main();\n prefix_identifier_not_followed_by_dot.main();\n prefix_shadowed_by_local_declaration.main();\n private_collision_in_mixin_application.main();\n private_optional_parameter.main();\n private_setter.main();\n receiver_of_type_never.main();\n recursive_compile_time_constant.main();\n recursive_constructor_redirect.main();\n recursive_factory_redirect.main();\n recursive_interface_inheritance.main();\n redirect_generative_to_missing_constructor.main();\n redirect_generative_to_non_generative_constructor.main();\n redirect_to_abstract_class_constructor.main();\n redirect_to_invalid_function_type.main();\n redirect_to_invalid_return_type.main();\n redirect_to_missing_constructor.main();\n redirect_to_non_class.main();\n redirect_to_non_const_constructor.main();\n referenced_before_declaration.main();\n rethrow_outside_catch.main();\n return_in_generative_constructor.main();\n return_in_generator.main();\n return_of_do_not_store.main();\n return_of_invalid_type.main();\n return_without_value.main();\n set_element_from_deferred_library.main();\n sdk_version_as_expression_in_const_context.main();\n sdk_version_async_exported_from_core.main();\n sdk_version_bool_operator_in_const_context.main();\n sdk_version_eq_eq_operator.main();\n sdk_version_extension_methods.main();\n sdk_version_gt_gt_gt_operator.main();\n sdk_version_is_expression_in_const_context.main();\n sdk_version_never.main();\n sdk_version_set_literal.main();\n sdk_version_ui_as_code.main();\n sdk_version_ui_as_code_in_const_context.main();\n set_element_type_not_assignable.main();\n shared_deferred_prefix.main();\n spread_expression_from_deferred_library.main();\n static_access_to_instance_member.main();\n strict_raw_type.main();\n subtype_of_ffi_class.main();\n subtype_of_sealed_class.main();\n subtype_of_struct_class.main();\n super_in_extension.main();\n super_in_invalid_context.main();\n super_in_redirecting_constructor.main();\n super_initializer_in_object.main();\n switch_case_completes_normally.main();\n switch_expression_not_assignable.main();\n throw_of_invalid_type.main();\n todo_test.main();\n top_level_cycle.main();\n top_level_instance_getter.main();\n top_level_instance_method.main();\n type_alias_cannot_reference_itself.main();\n type_annotation_deferred_class.main();\n type_argument_not_matching_bounds.main();\n type_check_is_not_null.main();\n type_check_is_null.main();\n type_parameter_referenced_by_static.main();\n type_parameter_supertype_of_its_bound.main();\n type_test_with_non_type.main();\n type_test_with_undefined_name.main();\n undefined_annotation.main();\n undefined_class_boolean.main();\n undefined_class.main();\n undefined_constructor_in_initializer_default.main();\n undefined_constructor_in_initializer.main();\n undefined_enum_constant.main();\n undefined_extension_getter.main();\n undefined_extension_method.main();\n undefined_extension_operator.main();\n undefined_extension_setter.main();\n undefined_getter.main();\n undefined_hidden_name.main();\n undefined_identifier_await.main();\n undefined_identifier.main();\n undefined_method.main();\n undefined_named_parameter.main();\n undefined_operator.main();\n undefined_prefixed_name.main();\n undefined_setter.main();\n undefined_shown_name.main();\n unnecessary_cast.main();\n unnecessary_no_such_method.main();\n unnecessary_non_null_assertion.main();\n unnecessary_null_comparison.main();\n unnecessary_type_check.main();\n unqualified_reference_to_non_local_static_member.main();\n unqualified_reference_to_static_member_of_extended_type.main();\n unused_catch_clause.main();\n unused_catch_stack.main();\n unused_element.main();\n unused_field.main();\n unused_import.main();\n unused_label.main();\n unused_local_variable.main();\n unused_shown_name.main();\n uri_does_not_exist.main();\n uri_with_interpolation.main();\n use_of_nullable_value_test.main();\n use_of_void_result.main();\n variable_type_mismatch.main();\n void_with_type_arguments_test.main();\n wrong_number_of_parameters_for_operator.main();\n wrong_number_of_parameters_for_setter.main();\n wrong_number_of_type_arguments_extension.main();\n wrong_number_of_type_arguments.main();\n wrong_type_parameter_variance_in_superinterface.main();\n yield_each_in_non_generator.main();\n yield_in_non_generator.main();\n yield_of_invalid_type.main();\n }, name: 'diagnostics');\n}\n","avg_line_length":50.8456561922,"max_line_length":82,"alphanum_fraction":0.8497137144} {"size":515,"ext":"dart","lang":"Dart","max_stars_count":6.0,"content":"part of 'auth_bloc.dart';\n\nabstract class AuthState extends Equatable {\n const AuthState();\n}\n\nclass AuthInitial extends AuthState {\n @override\n List get props => [];\n}\n\nclass AuthLoading extends AuthState {\n @override\n List get props => [];\n}\n\nclass AuthFailure extends AuthState {\n const AuthFailure({\n required this.message,\n });\n final String message;\n\n @override\n List get props => [];\n}\n\nclass AuthSuccess extends AuthState {\n @override\n List get props => [];\n}\n","avg_line_length":16.6129032258,"max_line_length":44,"alphanum_fraction":0.6912621359} {"size":2408,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:tekartik_notepad_sembast_app\/utils\/utils.dart';\nimport 'package:tekartik_common_utils\/model\/model.dart';\n\nabstract class DbRecord {\n \/\/\/ to override something like [name, description]\n List get fields;\n\n \/\/ Only created if necessary\n Map? _fieldMap;\n\n Field? getField(String name) {\n _fieldMap ??=\n Map.fromEntries(fields.map((field) => MapEntry(field.name, field)));\n return _fieldMap![name];\n }\n\n final id = Field('id');\n\n Field field(String name) {\n return Field(name);\n }\n\n Model toMap({List? fields}) {\n fields ??= this.fields;\n var model = Model();\n for (var field in fields) {\n model.setValue(field.name, field.v, presentIfNull: field.hasValue);\n }\n return model;\n }\n\n void fromMap(Map map, {List? fields, int? id}) {\n this.id.v = id;\n fields ??= this.fields;\n var model = Model(map);\n for (var field in fields) {\n var entry = model.getModelEntry(field.name);\n if (entry != null) {\n field.v = entry.value;\n }\n }\n }\n\n void fromRecord(DbRecord record) {\n for (var field in fields) {\n var recordField = record.getField(field.name);\n if (recordField?.hasValue == true) {\n field.fromField(recordField!);\n }\n }\n }\n\n @override\n String toString() => logTruncate(toMap(fields: [\n ...[id],\n ...fields\n ]).toString());\n}\n\nclass Column {\n final String name;\n\n Column(this.name);\n}\n\nclass Field extends Column {\n T? _value;\n\n \/\/\/ The value\n T? get v => _value;\n\n \/\/\/ The key\n String get k => name;\n\n bool get isNull => _value == null;\n\n set v(T? value) {\n _hasValue = true;\n _value = value;\n }\n\n void removeValue() {\n _value = null;\n _hasValue = false;\n }\n\n void setValue(T? value, {bool? presentIfNull}) {\n if (value == null) {\n if (presentIfNull != true) {\n v = value;\n } else {\n removeValue();\n }\n } else {\n v = value;\n }\n }\n\n bool _hasValue = false;\n\n bool get hasValue => _hasValue;\n\n Field(String name) : super(name);\n\n void fromField(Field field) {\n setValue(field.v, presentIfNull: field.hasValue);\n }\n\n @override\n String toString() => '$name: $v${(v == null && hasValue) ? ' (set)' : ''}';\n}\n\nField intField(String name) => Field(name);\n\nField stringField(String name) => Field(name);\n","avg_line_length":20.7586206897,"max_line_length":77,"alphanum_fraction":0.5955149502} {"size":904,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/*\n * Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file\n * for details. All rights reserved. Use of this source code is governed by a\n * BSD-style license that can be found in the LICENSE file.\n *\/\n\/**\n * @assertion An unqualified function invocation i has the form\n * id(a1, ..., an, xn+1: an+1, ..., xn+k: an+k), where id is an identifier.\n * If there exists a lexically visible declaration named id, let fid be the\n * innermost such declaration. Then:\n * . . .\n * Otherwise, . . .\n * If i does not occur inside a top level or static function, i is equivalent to\n * this.id(a1, ..., an, xn+1: an+1, ..., xn+k: an+k).\n * @description Checks that if there is no declaration and i occurs inside\n * a constructor, i is equivalent to this.id() and hence leads to compile error.\n * @compile-error\n * @author ilya\n *\/\n\nclass C {\n C() {\n undeclared();\n }\n}\n\nmain() {\n new C();\n}\n","avg_line_length":30.1333333333,"max_line_length":80,"alphanum_fraction":0.6603982301} {"size":4856,"ext":"dart","lang":"Dart","max_stars_count":2.0,"content":"import 'package:built_collection\/built_collection.dart';\nimport 'package:built_value\/built_value.dart';\nimport 'package:built_value\/serializer.dart';\n\nimport '..\/club.dart';\nimport '..\/common.dart';\nimport '..\/serializer.dart';\n\npart 'team.g.dart';\n\n\/\/\/\n\/\/\/ Used to pre-create an id before we write to the db. This lets us put this\n\/\/\/ id into other places when we do the submit.\n\/\/\/\nclass PregenUidRet {\n String uid;\n dynamic extra;\n}\n\n\/\/\/\n\/\/\/ Represents a team in the system. All the data associated with the team\n\/\/\/ and the database manipulation for the team.\n\/\/\/\nabstract class Team implements Built {\n \/\/\/ The name of the team.\n String get name;\n\n \/\/\/ How early people should arrive for the game by default. This is\n \/\/\/ overridden by the club potentially.\n @BuiltValueField(wireName: ARRIVALTIME)\n num get arriveEarlyInternal;\n\n \/\/\/ The uid associated with the currnet season.\n String get currentSeason;\n\n \/\/\/ the gender of the team.\n Gender get gender;\n\n \/\/\/ the league name the team is associated with.\n String get league;\n\n \/\/\/ The sport the team plays.\n Sport get sport;\n\n \/\/\/ the uid for the team.\n String get uid;\n\n \/\/\/ The url to get the photo from\n @nullable\n @BuiltValueField(wireName: photoUrlField)\n String get photoUrl;\n\n \/\/\/ If this team has been archived.\n @BuiltValueField(wireName: archivedField)\n BuiltMap get archivedData;\n\n \/\/\/ The user id in this team.\n @BuiltValueField(serialize: false)\n String get userUid;\n\n \/\/\/ If this is not null signifies that this team is a member of a club.\n @nullable\n String get clubUid;\n\n \/\/\/ If we can only see public details of this team.\n @BuiltValueField(serialize: false)\n bool get publicOnly;\n\n \/\/\/ If this team is publicaly visible.\n @BuiltValueField(wireName: isPublicField)\n bool get isPublic;\n\n \/\/\/ If we should track attendecne for games in this team. This is\n \/\/\/ overridden by the club potentially.\n @BuiltValueField(wireName: attendanceField)\n bool get trackAttendanceInternal;\n\n \/\/\/ This is a list of user ids, not player Ids.\n @BuiltValueField(wireName: adminsField)\n BuiltMap> get adminsData;\n\n @memoized\n BuiltSet get admins => BuiltSet.of(adminsData.keys);\n\n \/\/\/ The users setup for the team.\n @BuiltValueField(wireName: userField)\n BuiltMap> get users;\n\n \/\/\/ If the user is archvied from the team.\n @memoized\n bool get archived =>\n archivedData.containsKey(userUid) && archivedData[userUid];\n\n Team._();\n\n \/\/\/ Create a new team.\n factory Team([Function(TeamBuilder b) updates]) = _$Team;\n\n \/\/\/ The admins field.\n static const String adminsField = 'admins';\n\n \/\/\/ The track attendance field.\n static const String attendanceField = 'trackAttendance';\n\n \/\/\/ The club uid field.\n static const String clubUidField = 'clubUid';\n\n \/\/\/ The archived field.\n static const String archivedField = 'archived';\n\n \/\/\/ The users field.\n static const String userField = 'users';\n\n \/\/\/ The isPublic field.\n static const String isPublicField = 'isPublic';\n\n \/\/\/ The photo url field.\n static const String photoUrlField = 'photoUrl';\n\n static void _initializeBuilder(TeamBuilder b) => b\n ..userUid = ''\n ..isPublic = false\n ..publicOnly = false;\n\n \/\/\/ Deserialize the team.\n Map toMap() {\n return dataSerializers.serializeWith(Team.serializer, this);\n }\n\n \/\/\/ Creates a team from a mapping.\n static Team fromMap(String userUid, Map jsonData) {\n return dataSerializers\n .deserializeWith(Team.serializer, jsonData)\n .rebuild((b) => b..userUid = userUid);\n }\n\n static Serializer get serializer => _$teamSerializer;\n\n \/\/\/ Get the attendance tracking, potentially from the club.\n bool trackAttendance(Club club) {\n if (clubUid == null) {\n return trackAttendanceInternal;\n }\n if (club != null) {\n if (club.trackAttendence != Tristate.Unset) {\n return club.trackAttendence == Tristate.Yes;\n }\n }\n return trackAttendanceInternal;\n }\n\n \/\/\/ Get the early arrive, using the club value if this is 0.\n num arriveEarly(Club club) {\n if (publicOnly) {\n return 0;\n }\n if (arriveEarlyInternal == 0 && club != null) {\n num ret = club.arriveBeforeGame;\n if (ret != null) {\n return ret;\n }\n }\n return arriveEarlyInternal;\n }\n\n \/\/\/\n \/\/\/ Is the current user an admin for this team.\n \/\/\/\n bool isUserAdmin(String userId) {\n if (publicOnly) {\n return false;\n }\n return admins.contains(userId);\n }\n\n \/\/\/\n \/\/\/ Check if the current user is an admin\n \/\/\/\n bool isAdmin(Club club) {\n if (publicOnly) {\n return false;\n }\n if (club != null) {\n return isUserAdmin(userUid) || club.isUserAdmin(userUid);\n }\n return isUserAdmin(userUid);\n }\n}\n","avg_line_length":25.6931216931,"max_line_length":78,"alphanum_fraction":0.6793657331} {"size":2620,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'package:easy_localization\/easy_localization.dart';\nimport 'package:example\/menu_page.dart';\nimport 'package:example\/page_structure.dart';\nimport 'package:flutter\/cupertino.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter_zoom_drawer\/flutter_zoom_drawer.dart';\nimport 'package:provider\/provider.dart';\n\nclass HomeScreen extends StatefulWidget {\n static List mainMenu = [\n MenuItem(tr(\"payment\"), Icons.payment, 0),\n MenuItem(tr(\"promos\"), Icons.card_giftcard, 1),\n MenuItem(tr(\"notifications\"), Icons.notifications, 2),\n MenuItem(tr(\"help\"), Icons.help, 3),\n MenuItem(tr(\"about_us\"), Icons.info_outline, 4),\n ];\n\n @override\n _HomeScreenState createState() => new _HomeScreenState();\n}\n\nclass _HomeScreenState extends State {\n final _drawerController = ZoomDrawerController();\n\n int _currentPage = 0;\n\n @override\n Widget build(BuildContext context) {\n return ZoomDrawer(\n controller: _drawerController,\n style: DrawerStyle.Style7,\n menuScreen: MenuScreen(\n HomeScreen.mainMenu,\n callback: _updatePage,\n current: _currentPage,\n ),\n mainScreen: MainScreen(),\n borderRadius: 24.0,\n\/\/ showShadow: true,\n angle: 0.0,\n slideWidth:\n MediaQuery.of(context).size.width * (ZoomDrawer.isRTL() ? .45 : 0.65),\n \/\/ openCurve: Curves.fastOutSlowIn,\n \/\/ closeCurve: Curves.bounceIn,\n );\n }\n\n void _updatePage(index) {\n Provider.of(context, listen: false).updateCurrentPage(index);\n _drawerController.toggle();\n }\n}\n\nclass MainScreen extends StatefulWidget {\n @override\n _MainScreenState createState() => _MainScreenState();\n}\n\nclass _MainScreenState extends State {\n @override\n Widget build(BuildContext context) {\n final rtl = ZoomDrawer.isRTL();\n return ValueListenableBuilder(\n valueListenable: ZoomDrawer.of(context).stateNotifier,\n builder: (context, state, child) {\n return AbsorbPointer(\n absorbing: state != DrawerState.closed,\n child: child,\n );\n },\n child: GestureDetector(\n child: PageStructure(),\n onPanUpdate: (details) {\n if (details.delta.dx < 6 && !rtl || details.delta.dx < -6 && rtl) {\n ZoomDrawer.of(context).toggle();\n }\n },\n ),\n );\n }\n}\n\nclass MenuProvider extends ChangeNotifier {\n int _currentPage = 0;\n\n int get currentPage => _currentPage;\n\n void updateCurrentPage(int index) {\n if (index != currentPage) {\n _currentPage = index;\n notifyListeners();\n }\n }\n}\n","avg_line_length":27.5789473684,"max_line_length":80,"alphanum_fraction":0.6683206107} {"size":236,"ext":"dart","lang":"Dart","max_stars_count":3.0,"content":"enum StatsKeys {\n amberBonus,\n creatures,\n creaturesPower,\n creaturesArmor,\n upgrades,\n actions,\n artifacts,\n anomalies,\n maveriks,\n enhanced,\n rarityCommon,\n rarityRare,\n rarityUncommon,\n raritySpecial,\n rarityVariant\n}\n","avg_line_length":13.1111111111,"max_line_length":17,"alphanum_fraction":0.7245762712} {"size":548,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import '..\/..\/routes.dart';\n\nclass Topic {\n String asset, name;\n int length;\n Topic({\n required this.asset,\n required this.length,\n required this.name,\n });\n}\n\nList topicList = [\n Topic(\n asset: 'assets\/images\/thiruvalluvar.png',\n length: 1330,\n name: AppPages.kuralsListRoute),\n Topic(\n asset: 'assets\/images\/avvaiyar.png',\n length: 130,\n name: AppPages.aathichidiListRoute),\n Topic(\n asset: 'assets\/images\/thiruvalluvar.png',\n length: 1330,\n name: AppPages.kuralsListRoute),\n];\n","avg_line_length":20.2962962963,"max_line_length":47,"alphanum_fraction":0.6332116788} {"size":1056,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/material.dart';\nimport 'package:triathlon_app\/models\/HeartRate.dart';\nimport 'package:triathlon_app\/extensions\/FormattedDuration.dart';\nimport 'package:triathlon_app\/widgets\/HeartRateChart.dart';\n\nclass TrainingTileSummary extends StatelessWidget {\n\n final String title;\n final Duration duration;\n final HeartRate heartRate;\n\n const TrainingTileSummary({ Key? key, required this.title, required this.duration, required this.heartRate }) : super(key: key);\n\n @override\n Widget build(BuildContext context) {\n return Column(\n mainAxisSize: MainAxisSize.min,\n children: [\n Text(title, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 24),),\n ListTile(leading: Icon(Icons.timer), title: Text(duration.formatted)),\n ListTile(leading: Icon(Icons.favorite_outline), title: Text(heartRate.average.toStringAsFixed(2) + ' bpm')),\n Padding(\n padding: const EdgeInsets.fromLTRB(10, 25, 25, 10),\n child: HeartRateChart(heartRate: heartRate),\n ),\n ],\n );\n }\n}","avg_line_length":36.4137931034,"max_line_length":130,"alphanum_fraction":0.7130681818} {"size":248,"ext":"dart","lang":"Dart","max_stars_count":6.0,"content":"import 'package:flutter\/material.dart';\r\nimport 'package:flutter_easy\/flutter_easy.dart';\r\n\r\nclass HomeState {\r\n\r\n late AnimationController animationController;\r\n\r\n var clipboard = \"\".obs;\r\n\r\n HomeState() {\r\n \/\/\/Initialize variables\r\n }\r\n}\r\n","avg_line_length":17.7142857143,"max_line_length":49,"alphanum_fraction":0.6935483871} {"size":258,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"\/\/ Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nclass MacroBase {\n const MacroBase();\n}\n","avg_line_length":32.25,"max_line_length":77,"alphanum_fraction":0.7364341085} {"size":346,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'dart:io';\n\nimport 'package:image_picker\/image_picker.dart';\n\nclass PictureButtonController {\n bool used = false;\n File? picture;\n\n Future getPicture() async {\n final file = await ImagePicker().pickImage(\n source: ImageSource.gallery,\n imageQuality: 100,\n );\n picture = File(file!.path);\n used = true;\n }\n}\n","avg_line_length":19.2222222222,"max_line_length":48,"alphanum_fraction":0.6647398844} {"size":2281,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/material.dart';\nimport 'package:movie\/constants.dart';\nimport 'package:movie\/data\/models\/test.dart';\nimport 'package:movie\/screens\/movie_details\/components\/build_poster.dart';\nimport 'package:movie\/widgets\/curve_container.dart';\n\nclass MovieCover extends StatelessWidget {\n final Results mostPopular;\n\n const MovieCover({required this.mostPopular, Key? key}) : super(key: key);\n\n @override\n Widget build(BuildContext context) {\n return Stack(\n clipBehavior: Clip.none,\n children: [\n Container(\n height: 400,\n ),\n Padding(\n padding: const EdgeInsets.only(bottom: 2.0),\n child: ClipPath(\n clipper: CurveContainer(),\n child: Container(\n width: MediaQuery.of(context).size.width,\n height: 250.0,\n decoration: BoxDecoration(\n image: DecorationImage(\n fit: BoxFit.fill,\n image: mostPopular.backdropPath!.isEmpty\n ? const NetworkImage(\n \"https:\/\/i.pinimg.com\/originals\/6e\/6a\/e2\/6e6ae2b2367c74e2bd0be2f014cdf9f1.jpg\")\n : NetworkImage(imgeUrl + mostPopular.backdropPath!))),\n ),\n ),\n ),\n Positioned(\n top: 20,\n right: 10,\n left: 10,\n child: Row(\n children: [\n IconButton(\n onPressed: () => Navigator.pop(context),\n icon: const Icon(\n Icons.arrow_back_ios,\n \/\/ size: 40,\n color: Colors.white,\n )),\n const Spacer(),\n IconButton(\n onPressed: () {},\n icon: const Icon(\n Icons.favorite_border,\n color: Colors.white,\n )),\n IconButton(\n onPressed: () {},\n icon: const Icon(\n Icons.more_vert_outlined,\n \/\/ size: 40,\n color: Colors.white,\n )),\n ],\n ),\n ),\n BuildPoster(\n mostPopular: mostPopular,\n ),\n ],\n );\n }\n}\n","avg_line_length":30.8243243243,"max_line_length":109,"alphanum_fraction":0.4774221833} {"size":4330,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:example\/content.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:swipe_cards\/draggable_card.dart';\nimport 'package:swipe_cards\/swipe_cards.dart';\n\nimport 'content.dart';\n\nvoid main() {\n runApp(MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n title: 'Swipe Cards Demo',\n theme: ThemeData(\n primarySwatch: Colors.blue,\n visualDensity: VisualDensity.adaptivePlatformDensity,\n ),\n home: MyHomePage(title: 'Swipe Cards Demo'),\n debugShowCheckedModeBanner: false,\n );\n }\n}\n\nclass MyHomePage extends StatefulWidget {\n MyHomePage({Key? key, this.title}) : super(key: key);\n\n final String? title;\n\n @override\n _MyHomePageState createState() => _MyHomePageState();\n}\n\nclass _MyHomePageState extends State {\n List _swipeItems = [];\n MatchEngine? _matchEngine;\n GlobalKey _scaffoldKey = GlobalKey();\n List _names = [\n \"Red\",\n \"Blue\",\n \"Green\",\n \"Yellow\",\n \"Orange\",\n \"Grey\",\n \"Purple\",\n \"Pink\"\n ];\n List _colors = [\n Colors.red,\n Colors.blue,\n Colors.green,\n Colors.yellow,\n Colors.orange,\n Colors.grey,\n Colors.purple,\n Colors.pink\n ];\n\n @override\n void initState() {\n for (int i = 0; i < _names.length; i++) {\n _swipeItems.add(SwipeItem(\n content: Content(text: _names[i], color: _colors[i]),\n likeAction: () {\n _scaffoldKey.currentState?.showSnackBar(SnackBar(\n content: Text(\"Liked ${_names[i]}\"),\n duration: Duration(milliseconds: 500),\n ));\n },\n nopeAction: () {\n _scaffoldKey.currentState?.showSnackBar(SnackBar(\n content: Text(\"Nope ${_names[i]}\"),\n duration: Duration(milliseconds: 500),\n ));\n },\n superlikeAction: () {\n _scaffoldKey.currentState?.showSnackBar(SnackBar(\n content: Text(\"Superliked ${_names[i]}\"),\n duration: Duration(milliseconds: 500),\n ));\n },\n onSlideUpdate: (SlideRegion? region) async {\n print(\"Region $region\");\n }));\n }\n\n _matchEngine = MatchEngine(swipeItems: _swipeItems);\n super.initState();\n }\n\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n key: _scaffoldKey,\n appBar: AppBar(\n title: Text(widget.title!),\n ),\n body: Container(\n child: Stack(children: [\n Container(\n height: MediaQuery.of(context).size.height - kToolbarHeight,\n child: SwipeCards(\n matchEngine: _matchEngine!,\n itemBuilder: (BuildContext context, int index) {\n return Container(\n alignment: Alignment.center,\n color: _swipeItems[index].content.color,\n child: Text(\n _swipeItems[index].content.text,\n style: TextStyle(fontSize: 100),\n ),\n );\n },\n onStackFinished: () {\n _scaffoldKey.currentState!.showSnackBar(SnackBar(\n content: Text(\"Stack Finished\"),\n duration: Duration(milliseconds: 500),\n ));\n },\n itemChanged: (SwipeItem item, int index) {\n print(\"item: ${item.content.text}, index: $index\");\n },\n upSwipeAllowed: true,\n fillSpace: true,\n ),\n ),\n Row(\n mainAxisAlignment: MainAxisAlignment.spaceEvenly,\n children: [\n ElevatedButton(\n onPressed: () {\n _matchEngine!.currentItem?.nope();\n },\n child: Text(\"Nope\")),\n ElevatedButton(\n onPressed: () {\n _matchEngine!.currentItem?.superLike();\n },\n child: Text(\"Superlike\")),\n ElevatedButton(\n onPressed: () {\n _matchEngine!.currentItem?.like();\n },\n child: Text(\"Like\"))\n ],\n )\n ])));\n }\n}\n","avg_line_length":28.4868421053,"max_line_length":72,"alphanum_fraction":0.5272517321} {"size":1968,"ext":"dart","lang":"Dart","max_stars_count":40.0,"content":"import 'dart:math';\n\nimport 'package:fmovies\/src\/core\/db\/database.dart';\nimport 'package:fmovies\/src\/features\/popular\/data\/models\/popular_movies_response.dart';\n\nclass DataFactory {\n static int randomInt() {\n return Random().nextInt(100);\n }\n\n static String randomString() {\n return (Random().nextInt(100) +\n Random().nextInt(1000) +\n Random().nextDouble())\n .toString();\n }\n\n static bool randomBool() {\n return Random().nextBool();\n }\n\n static Movie createMovie() {\n return Movie(\n id: randomInt(),\n voteCount: randomInt(),\n posterPath: randomString(),\n adult: randomBool(),\n originalTitle: randomString(),\n title: randomString(),\n overview: randomString(),\n releaseDate: randomString(),\n backdropPath: randomString(),\n isFavorite: randomBool());\n }\n\n static List createMovies() {\n return List.generate(3, (index) {\n return createMovie();\n });\n }\n\n static PopularMoviesResponse createPopularMovieResponse() {\n return PopularMoviesResponse(\n page: 1, totalPages: 10, results: createMovies());\n }\n\n static String dummyJsonResponse() {\n return \"{\\\"page\\\":1,\\\"total_results\\\":10000,\\\"total_pages\\\":500,\\\"results\\\":[{\\\"popularity\\\":211.653,\\\"vote_count\\\":290,\\\"video\\\":false,\\\"poster_path\\\":\\\"\\\/kTQ3J8oTTKofAVLYnds2cHUz9KO.jpg\\\",\\\"id\\\":522938,\\\"adult\\\":false,\\\"backdrop_path\\\":\\\"\\\/spYx9XQFODuqEVoPpvaJI1ksAVt.jpg\\\",\\\"original_language\\\":\\\"en\\\",\\\"original_title\\\":\\\"Rambo: Last Blood\\\",\\\"genre_ids\\\":[28,53],\\\"title\\\":\\\"Rambo: Last Blood\\\",\\\"vote_average\\\":6.2,\\\"overview\\\":\\\"When John Rambo's niece travels to Mexico to find the father that abandoned her and her mother, she finds herself in the grasps of Calle Mexican sex traffickers. When she doesn't return home as expected, John learns she's crossed into Mexico and sets out to get her back and make them pay.\\\",\\\"release_date\\\":\\\"2019-09-20\\\"}]}\";\n }\n}\n","avg_line_length":38.5882352941,"max_line_length":768,"alphanum_fraction":0.6615853659} {"size":742,"ext":"dart","lang":"Dart","max_stars_count":9.0,"content":"import 'package:flutter\/material.dart';\n\nclass Circle extends StatelessWidget {\n final Color color;\n final double radius;\n final bool showShadow;\n final Widget child;\n\n const Circle({this.color=Colors.blue, this.radius=6,this.showShadow=true,this.child});\n\n @override\n Widget build(BuildContext context) {\n return Container(\n alignment: Alignment.center,\n child: child==null?Container():child,\n width: 2*radius,\n height: 2*radius,\n decoration: BoxDecoration(\n color: color,\n shape: BoxShape.circle,\n boxShadow: [\n if (showShadow)\n BoxShadow(\n color: Colors.grey,\n offset: Offset(.5,.5),\n blurRadius: .5,\n )]\n ),\n );\n }\n}\n","avg_line_length":23.1875,"max_line_length":88,"alphanum_fraction":0.6091644205} {"size":1337,"ext":"dart","lang":"Dart","max_stars_count":89.0,"content":"import 'package:flutter\/material.dart';\nimport 'package:whatsapp_clone\/models\/message.dart';\n\nimport '..\/..\/..\/consts.dart';\n\n\nclass DismssibleBubble extends StatelessWidget {\n final bool isMe;\n final Message message;\n final Widget child;\n final Function onDismissed;\n const DismssibleBubble({\n this.isMe,\n this.message,\n this.child,\n this.onDismissed,\n Key key,\n\n }) : super(key: key);\n\n @override\n Widget build(BuildContext context) {\n return Dismissible( \n direction: isMe\n ? DismissDirection.endToStart\n : DismissDirection.startToEnd,\n onDismissed: (direction) {},\n key: UniqueKey(),\n confirmDismiss: (_) async { \n final f = Future.delayed(Duration.zero).then((value) {\n onDismissed(message);\n return false;\n });\n return await f;\n },\n background: Align(\n alignment: isMe ? Alignment.centerRight : Alignment.centerLeft,\n child: Wrap(\n children: [\n if(!isMe)\n SizedBox(width: 20),\n FittedBox(\n child: Icon(\n Icons.reply,\n color: kBaseWhiteColor.withOpacity(0.5),\n )),\n if(isMe)\n SizedBox(width: 20),\n ],\n ),\n ),\n child: child,\n );\n }\n}\n","avg_line_length":23.875,"max_line_length":71,"alphanum_fraction":0.5519820494} {"size":130591,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ This is a generated file (see the discoveryapis_generator project).\n\n\/\/ ignore_for_file: unused_import, unnecessary_cast\n\nlibrary googleapis_beta.prod_tt_sasportal.v1alpha1;\n\nimport 'dart:core' as core;\nimport 'dart:async' as async;\nimport 'dart:convert' as convert;\n\nimport 'package:_discoveryapis_commons\/_discoveryapis_commons.dart' as commons;\nimport 'package:http\/http.dart' as http;\n\nexport 'package:_discoveryapis_commons\/_discoveryapis_commons.dart'\n show ApiRequestError, DetailedApiRequestError;\n\nconst core.String USER_AGENT = 'dart-api-client prod_tt_sasportal\/v1alpha1';\n\nclass ProdTtSasportalApi {\n \/\/\/ View your email address\n static const UserinfoEmailScope =\n \"https:\/\/www.googleapis.com\/auth\/userinfo.email\";\n\n final commons.ApiRequester _requester;\n\n CustomersResourceApi get customers => new CustomersResourceApi(_requester);\n InstallerResourceApi get installer => new InstallerResourceApi(_requester);\n NodesResourceApi get nodes => new NodesResourceApi(_requester);\n PoliciesResourceApi get policies => new PoliciesResourceApi(_requester);\n\n ProdTtSasportalApi(http.Client client,\n {core.String rootUrl = \"https:\/\/prod-tt-sasportal.googleapis.com\/\",\n core.String servicePath = \"\"})\n : _requester =\n new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT);\n}\n\nclass CustomersResourceApi {\n final commons.ApiRequester _requester;\n\n CustomersDevicesResourceApi get devices =>\n new CustomersDevicesResourceApi(_requester);\n CustomersNodesResourceApi get nodes =>\n new CustomersNodesResourceApi(_requester);\n\n CustomersResourceApi(commons.ApiRequester client) : _requester = client;\n\n \/\/\/ Returns a requested customer.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the customer.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalCustomer].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future get(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalCustomer.fromJson(data));\n }\n\n \/\/\/ Returns a list of requested customers.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListCustomers method that indicates where\n \/\/\/ this listing should continue from.\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of customers\n \/\/\/ to return in the response.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListCustomersResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(\n {core.String pageToken, core.int pageSize, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/customers';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListCustomersResponse.fromJson(data));\n }\n\n \/\/\/ Updates an existing customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Output only. Resource name of the customer.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [updateMask] - Fields to be updated.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalCustomer].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future patch(\n SasPortalCustomer request, core.String name,\n {core.String updateMask, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if (updateMask != null) {\n _queryParams[\"updateMask\"] = [updateMask];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"PATCH\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalCustomer.fromJson(data));\n }\n}\n\nclass CustomersDevicesResourceApi {\n final commons.ApiRequester _requester;\n\n CustomersDevicesResourceApi(commons.ApiRequester client)\n : _requester = client;\n\n \/\/\/ Creates a device under a node or customer. Returned devices are unordered.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalBulkCreateDeviceResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future bulk(\n SasPortalBulkCreateDeviceRequest request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices:bulk';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalBulkCreateDeviceResponse.fromJson(data));\n }\n\n \/\/\/ Creates a device under a node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future create(\n SasPortalDevice request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Creates a signed device under a\n \/\/\/ node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future createSigned(\n SasPortalCreateSignedDeviceRequest request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices:createSigned';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Deletes a device.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalEmpty].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future delete(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"DELETE\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalEmpty.fromJson(data));\n }\n\n \/\/\/ Gets details about a device.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future get(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Lists devices under a node or customer.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListDevices\n \/\/\/ that indicates where this listing should continue from.\n \/\/\/\n \/\/\/ [filter] - The filter expression. The filter should have one of the\n \/\/\/ following\n \/\/\/ formats: \"sn=123454\" or \"display_name=MyDevice\". sn\n \/\/\/ corresponds to serial_number of the device. The filter is case\n \/\/\/ insensitive.\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of devices to return in the response.\n \/\/\/ If empty or zero, all devices will be listed.\n \/\/\/ Must be in the range [0, 1000].\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListDevicesResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(core.String parent,\n {core.String pageToken,\n core.String filter,\n core.int pageSize,\n core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if (filter != null) {\n _queryParams[\"filter\"] = [filter];\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListDevicesResponse.fromJson(data));\n }\n\n \/\/\/ Moves a device under another node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device to move.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalOperation].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future move(\n SasPortalMoveDeviceRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url =\n 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name') + ':move';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalOperation.fromJson(data));\n }\n\n \/\/\/ Updates a device.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Output only. The resource path name.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [updateMask] - Fields to be updated.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future patch(SasPortalDevice request, core.String name,\n {core.String updateMask, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if (updateMask != null) {\n _queryParams[\"updateMask\"] = [updateMask];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"PATCH\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Signs a device.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Output only. The resource path name.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalEmpty].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future signDevice(\n SasPortalSignDeviceRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$name') +\n ':signDevice';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalEmpty.fromJson(data));\n }\n\n \/\/\/ Updates a signed device.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device to update.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future updateSigned(\n SasPortalUpdateSignedDeviceRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$name') +\n ':updateSigned';\n\n var _response = _requester.request(_url, \"PATCH\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n}\n\nclass CustomersNodesResourceApi {\n final commons.ApiRequester _requester;\n\n CustomersNodesNodesResourceApi get nodes =>\n new CustomersNodesNodesResourceApi(_requester);\n\n CustomersNodesResourceApi(commons.ApiRequester client) : _requester = client;\n\n \/\/\/ Creates a new node.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name where the node is to be\n \/\/\/ created.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future create(SasPortalNode request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n\n \/\/\/ Deletes a node.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the node.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalEmpty].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future delete(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"DELETE\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalEmpty.fromJson(data));\n }\n\n \/\/\/ Returns a requested node.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the node.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future get(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n\n \/\/\/ Lists nodes.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name, for example, \"nodes\/1\".\n \/\/\/ Value must have pattern \"^customers\/[^\/]+$\".\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of nodes to return in the response.\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListNodes method\n \/\/\/ that indicates where this listing should continue from.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListNodesResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(core.String parent,\n {core.int pageSize, core.String pageToken, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListNodesResponse.fromJson(data));\n }\n\n \/\/\/ Moves a node under another node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the node to\n \/\/\/ move.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalOperation].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future move(\n SasPortalMoveNodeRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url =\n 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name') + ':move';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalOperation.fromJson(data));\n }\n\n \/\/\/ Updates an existing node.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Output only. Resource name.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [updateMask] - Fields to be updated.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future patch(SasPortalNode request, core.String name,\n {core.String updateMask, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if (updateMask != null) {\n _queryParams[\"updateMask\"] = [updateMask];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"PATCH\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n}\n\nclass CustomersNodesNodesResourceApi {\n final commons.ApiRequester _requester;\n\n CustomersNodesNodesResourceApi(commons.ApiRequester client)\n : _requester = client;\n\n \/\/\/ Creates a new node.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name where the node is to be\n \/\/\/ created.\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future create(SasPortalNode request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n\n \/\/\/ Lists nodes.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name, for example, \"nodes\/1\".\n \/\/\/ Value must have pattern \"^customers\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListNodes method\n \/\/\/ that indicates where this listing should continue from.\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of nodes to return in the response.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListNodesResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(core.String parent,\n {core.String pageToken, core.int pageSize, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListNodesResponse.fromJson(data));\n }\n}\n\nclass InstallerResourceApi {\n final commons.ApiRequester _requester;\n\n InstallerResourceApi(commons.ApiRequester client) : _requester = client;\n\n \/\/\/ Generates a secret to be used with the ValidateInstaller method\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalGenerateSecretResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future generateSecret(\n SasPortalGenerateSecretRequest request,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/installer:generateSecret';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalGenerateSecretResponse.fromJson(data));\n }\n\n \/\/\/ Validates the identity of a Certified Professional Installer (CPI).\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalValidateInstallerResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future validate(\n SasPortalValidateInstallerRequest request,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/installer:validate';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalValidateInstallerResponse.fromJson(data));\n }\n}\n\nclass NodesResourceApi {\n final commons.ApiRequester _requester;\n\n NodesDevicesResourceApi get devices =>\n new NodesDevicesResourceApi(_requester);\n NodesNodesResourceApi get nodes => new NodesNodesResourceApi(_requester);\n\n NodesResourceApi(commons.ApiRequester client) : _requester = client;\n}\n\nclass NodesDevicesResourceApi {\n final commons.ApiRequester _requester;\n\n NodesDevicesResourceApi(commons.ApiRequester client) : _requester = client;\n\n \/\/\/ Creates a device under a node or customer. Returned devices are unordered.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalBulkCreateDeviceResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future bulk(\n SasPortalBulkCreateDeviceRequest request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices:bulk';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalBulkCreateDeviceResponse.fromJson(data));\n }\n\n \/\/\/ Creates a device under a node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future create(\n SasPortalDevice request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Creates a signed device under a\n \/\/\/ node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future createSigned(\n SasPortalCreateSignedDeviceRequest request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices:createSigned';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Deletes a device.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalEmpty].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future delete(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"DELETE\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalEmpty.fromJson(data));\n }\n\n \/\/\/ Gets details about a device.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future get(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Lists devices under a node or customer.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of devices to return in the response.\n \/\/\/ If empty or zero, all devices will be listed.\n \/\/\/ Must be in the range [0, 1000].\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListDevices\n \/\/\/ that indicates where this listing should continue from.\n \/\/\/\n \/\/\/ [filter] - The filter expression. The filter should have one of the\n \/\/\/ following\n \/\/\/ formats: \"sn=123454\" or \"display_name=MyDevice\". sn\n \/\/\/ corresponds to serial_number of the device. The filter is case\n \/\/\/ insensitive.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListDevicesResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(core.String parent,\n {core.int pageSize,\n core.String pageToken,\n core.String filter,\n core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if (filter != null) {\n _queryParams[\"filter\"] = [filter];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListDevicesResponse.fromJson(data));\n }\n\n \/\/\/ Moves a device under another node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device to move.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalOperation].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future move(\n SasPortalMoveDeviceRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url =\n 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name') + ':move';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalOperation.fromJson(data));\n }\n\n \/\/\/ Updates a device.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Output only. The resource path name.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [updateMask] - Fields to be updated.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future patch(SasPortalDevice request, core.String name,\n {core.String updateMask, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if (updateMask != null) {\n _queryParams[\"updateMask\"] = [updateMask];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"PATCH\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Signs a device.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Output only. The resource path name.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalEmpty].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future signDevice(\n SasPortalSignDeviceRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$name') +\n ':signDevice';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalEmpty.fromJson(data));\n }\n\n \/\/\/ Updates a signed device.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the device to update.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/devices\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future updateSigned(\n SasPortalUpdateSignedDeviceRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$name') +\n ':updateSigned';\n\n var _response = _requester.request(_url, \"PATCH\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n}\n\nclass NodesNodesResourceApi {\n final commons.ApiRequester _requester;\n\n NodesNodesDevicesResourceApi get devices =>\n new NodesNodesDevicesResourceApi(_requester);\n NodesNodesNodesResourceApi get nodes =>\n new NodesNodesNodesResourceApi(_requester);\n\n NodesNodesResourceApi(commons.ApiRequester client) : _requester = client;\n\n \/\/\/ Creates a new node.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name where the node is to be\n \/\/\/ created.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future create(SasPortalNode request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n\n \/\/\/ Deletes a node.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the node.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalEmpty].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future delete(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"DELETE\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalEmpty.fromJson(data));\n }\n\n \/\/\/ Returns a requested node.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the node.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future get(core.String name, {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n\n \/\/\/ Lists nodes.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name, for example, \"nodes\/1\".\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListNodes method\n \/\/\/ that indicates where this listing should continue from.\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of nodes to return in the response.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListNodesResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(core.String parent,\n {core.String pageToken, core.int pageSize, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListNodesResponse.fromJson(data));\n }\n\n \/\/\/ Moves a node under another node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Required. The name of the node to\n \/\/\/ move.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalOperation].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future move(\n SasPortalMoveNodeRequest request, core.String name,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url =\n 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name') + ':move';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalOperation.fromJson(data));\n }\n\n \/\/\/ Updates an existing node.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [name] - Output only. Resource name.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [updateMask] - Fields to be updated.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future patch(SasPortalNode request, core.String name,\n {core.String updateMask, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (name == null) {\n throw new core.ArgumentError(\"Parameter name is required.\");\n }\n if (updateMask != null) {\n _queryParams[\"updateMask\"] = [updateMask];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' + commons.Escaper.ecapeVariableReserved('$name');\n\n var _response = _requester.request(_url, \"PATCH\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n}\n\nclass NodesNodesDevicesResourceApi {\n final commons.ApiRequester _requester;\n\n NodesNodesDevicesResourceApi(commons.ApiRequester client)\n : _requester = client;\n\n \/\/\/ Creates a device under a node or customer. Returned devices are unordered.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalBulkCreateDeviceResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future bulk(\n SasPortalBulkCreateDeviceRequest request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices:bulk';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalBulkCreateDeviceResponse.fromJson(data));\n }\n\n \/\/\/ Creates a device under a node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future create(\n SasPortalDevice request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Creates a signed device under a\n \/\/\/ node or customer.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalDevice].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future createSigned(\n SasPortalCreateSignedDeviceRequest request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices:createSigned';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalDevice.fromJson(data));\n }\n\n \/\/\/ Lists devices under a node or customer.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The name of the parent resource.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of devices to return in the response.\n \/\/\/ If empty or zero, all devices will be listed.\n \/\/\/ Must be in the range [0, 1000].\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListDevices\n \/\/\/ that indicates where this listing should continue from.\n \/\/\/\n \/\/\/ [filter] - The filter expression. The filter should have one of the\n \/\/\/ following\n \/\/\/ formats: \"sn=123454\" or \"display_name=MyDevice\". sn\n \/\/\/ corresponds to serial_number of the device. The filter is case\n \/\/\/ insensitive.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListDevicesResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(core.String parent,\n {core.int pageSize,\n core.String pageToken,\n core.String filter,\n core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if (filter != null) {\n _queryParams[\"filter\"] = [filter];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/devices';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListDevicesResponse.fromJson(data));\n }\n}\n\nclass NodesNodesNodesResourceApi {\n final commons.ApiRequester _requester;\n\n NodesNodesNodesResourceApi(commons.ApiRequester client) : _requester = client;\n\n \/\/\/ Creates a new node.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name where the node is to be\n \/\/\/ created.\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalNode].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future create(SasPortalNode request, core.String parent,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalNode.fromJson(data));\n }\n\n \/\/\/ Lists nodes.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [parent] - Required. The parent resource name, for example, \"nodes\/1\".\n \/\/\/ Value must have pattern \"^nodes\/[^\/]+\/nodes\/[^\/]+$\".\n \/\/\/\n \/\/\/ [pageSize] - The maximum number of nodes to return in the response.\n \/\/\/\n \/\/\/ [pageToken] - A pagination token returned from a previous call to\n \/\/\/ ListNodes method\n \/\/\/ that indicates where this listing should continue from.\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalListNodesResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future list(core.String parent,\n {core.int pageSize, core.String pageToken, core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (parent == null) {\n throw new core.ArgumentError(\"Parameter parent is required.\");\n }\n if (pageSize != null) {\n _queryParams[\"pageSize\"] = [\"${pageSize}\"];\n }\n if (pageToken != null) {\n _queryParams[\"pageToken\"] = [pageToken];\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/' +\n commons.Escaper.ecapeVariableReserved('$parent') +\n '\/nodes';\n\n var _response = _requester.request(_url, \"GET\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalListNodesResponse.fromJson(data));\n }\n}\n\nclass PoliciesResourceApi {\n final commons.ApiRequester _requester;\n\n PoliciesResourceApi(commons.ApiRequester client) : _requester = client;\n\n \/\/\/ Gets the access control policy for a resource.\n \/\/\/ Returns an empty policy if the resource exists and does not have a policy\n \/\/\/ set.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalPolicy].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future get(SasPortalGetPolicyRequest request,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/policies:get';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalPolicy.fromJson(data));\n }\n\n \/\/\/ Sets the access control policy on the specified resource. Replaces any\n \/\/\/ existing policy.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalPolicy].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future set(SasPortalSetPolicyRequest request,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/policies:set';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response.then((data) => new SasPortalPolicy.fromJson(data));\n }\n\n \/\/\/ Returns permissions that a caller has on the specified resource.\n \/\/\/\n \/\/\/ [request] - The metadata request object.\n \/\/\/\n \/\/\/ Request parameters:\n \/\/\/\n \/\/\/ [$fields] - Selector specifying which fields to include in a partial\n \/\/\/ response.\n \/\/\/\n \/\/\/ Completes with a [SasPortalTestPermissionsResponse].\n \/\/\/\n \/\/\/ Completes with a [commons.ApiRequestError] if the API endpoint returned an\n \/\/\/ error.\n \/\/\/\n \/\/\/ If the used [http.Client] completes with an error when making a REST call,\n \/\/\/ this method will complete with the same error.\n async.Future test(\n SasPortalTestPermissionsRequest request,\n {core.String $fields}) {\n var _url;\n var _queryParams = new core.Map>();\n var _uploadMedia;\n var _uploadOptions;\n var _downloadOptions = commons.DownloadOptions.Metadata;\n var _body;\n\n if (request != null) {\n _body = convert.json.encode((request).toJson());\n }\n if ($fields != null) {\n _queryParams[\"fields\"] = [$fields];\n }\n\n _url = 'v1alpha1\/policies:test';\n\n var _response = _requester.request(_url, \"POST\",\n body: _body,\n queryParams: _queryParams,\n uploadOptions: _uploadOptions,\n uploadMedia: _uploadMedia,\n downloadOptions: _downloadOptions);\n return _response\n .then((data) => new SasPortalTestPermissionsResponse.fromJson(data));\n }\n}\n\n\/\/\/ Associates `members` with a `role`.\nclass SasPortalAssignment {\n \/\/\/ The identities the role is assigned to. It can have the following\n \/\/\/ values:\n \/\/\/\n \/\/\/ * `{user_email}`: An email address that represents a specific\n \/\/\/ Google account. For example: `alice@gmail.com`.\n \/\/\/\n \/\/\/ * `{group_email}`: An email address that represents a Google\n \/\/\/ group. For example, `viewers@gmail.com`.\n core.List members;\n\n \/\/\/ Required. Role that is assigned to `members`.\n core.String role;\n\n SasPortalAssignment();\n\n SasPortalAssignment.fromJson(core.Map _json) {\n if (_json.containsKey(\"members\")) {\n members = (_json[\"members\"] as core.List).cast();\n }\n if (_json.containsKey(\"role\")) {\n role = _json[\"role\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (members != null) {\n _json[\"members\"] = members;\n }\n if (role != null) {\n _json[\"role\"] = role;\n }\n return _json;\n }\n}\n\n\/\/\/ Request for BulkCreateDevice method.\nclass SasPortalBulkCreateDeviceRequest {\n \/\/\/ Required. A csv with each row representing a [device]. Each row must\n \/\/\/ conform to the regulations described on CreateDeviceRequest's device\n \/\/\/ field.\n core.String csv;\n\n SasPortalBulkCreateDeviceRequest();\n\n SasPortalBulkCreateDeviceRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"csv\")) {\n csv = _json[\"csv\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (csv != null) {\n _json[\"csv\"] = csv;\n }\n return _json;\n }\n}\n\n\/\/\/ Response for BulkCreateDevice method.\nclass SasPortalBulkCreateDeviceResponse {\n \/\/\/ Required. The devices that were imported.\n core.List devices;\n\n SasPortalBulkCreateDeviceResponse();\n\n SasPortalBulkCreateDeviceResponse.fromJson(core.Map _json) {\n if (_json.containsKey(\"devices\")) {\n devices = (_json[\"devices\"] as core.List)\n .map((value) => new SasPortalDevice.fromJson(value))\n .toList();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (devices != null) {\n _json[\"devices\"] = devices.map((value) => (value).toJson()).toList();\n }\n return _json;\n }\n}\n\n\/\/\/ Request for CreateSignedDevice method.\nclass SasPortalCreateSignedDeviceRequest {\n \/\/\/ Required. JSON Web Token signed using a CPI private key. Payload\n \/\/\/ must be the JSON encoding of the [Device]. The user_id field must be set.\n core.String encodedDevice;\n core.List get encodedDeviceAsBytes {\n return convert.base64.decode(encodedDevice);\n }\n\n set encodedDeviceAsBytes(core.List _bytes) {\n encodedDevice =\n convert.base64.encode(_bytes).replaceAll(\"\/\", \"_\").replaceAll(\"+\", \"-\");\n }\n\n \/\/\/ Required. Unique installer id (cpiId) from the Certified Professional\n \/\/\/ Installers database.\n core.String installerId;\n\n SasPortalCreateSignedDeviceRequest();\n\n SasPortalCreateSignedDeviceRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"encodedDevice\")) {\n encodedDevice = _json[\"encodedDevice\"];\n }\n if (_json.containsKey(\"installerId\")) {\n installerId = _json[\"installerId\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (encodedDevice != null) {\n _json[\"encodedDevice\"] = encodedDevice;\n }\n if (installerId != null) {\n _json[\"installerId\"] = installerId;\n }\n return _json;\n }\n}\n\n\/\/\/ Entity representing a SAS customer.\nclass SasPortalCustomer {\n \/\/\/ Required. Name of the organization that the customer entity represents.\n core.String displayName;\n\n \/\/\/ Output only. Resource name of the customer.\n core.String name;\n\n \/\/\/ User IDs used by the devices belonging to this customer.\n core.List sasUserIds;\n\n SasPortalCustomer();\n\n SasPortalCustomer.fromJson(core.Map _json) {\n if (_json.containsKey(\"displayName\")) {\n displayName = _json[\"displayName\"];\n }\n if (_json.containsKey(\"name\")) {\n name = _json[\"name\"];\n }\n if (_json.containsKey(\"sasUserIds\")) {\n sasUserIds = (_json[\"sasUserIds\"] as core.List).cast();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (displayName != null) {\n _json[\"displayName\"] = displayName;\n }\n if (name != null) {\n _json[\"name\"] = name;\n }\n if (sasUserIds != null) {\n _json[\"sasUserIds\"] = sasUserIds;\n }\n return _json;\n }\n}\n\nclass SasPortalDevice {\n \/\/\/ Output only. Current configuration of the device as registered to the SAS.\n SasPortalDeviceConfig activeConfig;\n\n \/\/\/ Device display name.\n core.String displayName;\n\n \/\/\/ The FCC identifier of the device.\n core.String fccId;\n\n \/\/\/ Output only. Grants held by the device.\n core.List grants;\n\n \/\/\/ Output only. The resource path name.\n core.String name;\n\n \/\/\/ Configuration of the device, as specified via SAS Portal API.\n SasPortalDeviceConfig preloadedConfig;\n\n \/\/\/ A serial number assigned to the device by the device\n \/\/\/ manufacturer.\n core.String serialNumber;\n\n \/\/\/ Output only. Device state.\n \/\/\/ Possible string values are:\n \/\/\/ - \"DEVICE_STATE_UNSPECIFIED\" : Unspecified state.\n \/\/\/ - \"RESERVED\" : Device created in the SAS Portal, however, not yet\n \/\/\/ registered\n \/\/\/ with SAS.\n \/\/\/ - \"REGISTERED\" : Device registered with SAS.\n \/\/\/ - \"DEREGISTERED\" : Device de-registered with SAS.\n core.String state;\n\n SasPortalDevice();\n\n SasPortalDevice.fromJson(core.Map _json) {\n if (_json.containsKey(\"activeConfig\")) {\n activeConfig = new SasPortalDeviceConfig.fromJson(_json[\"activeConfig\"]);\n }\n if (_json.containsKey(\"displayName\")) {\n displayName = _json[\"displayName\"];\n }\n if (_json.containsKey(\"fccId\")) {\n fccId = _json[\"fccId\"];\n }\n if (_json.containsKey(\"grants\")) {\n grants = (_json[\"grants\"] as core.List)\n .map(\n (value) => new SasPortalDeviceGrant.fromJson(value))\n .toList();\n }\n if (_json.containsKey(\"name\")) {\n name = _json[\"name\"];\n }\n if (_json.containsKey(\"preloadedConfig\")) {\n preloadedConfig =\n new SasPortalDeviceConfig.fromJson(_json[\"preloadedConfig\"]);\n }\n if (_json.containsKey(\"serialNumber\")) {\n serialNumber = _json[\"serialNumber\"];\n }\n if (_json.containsKey(\"state\")) {\n state = _json[\"state\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (activeConfig != null) {\n _json[\"activeConfig\"] = (activeConfig).toJson();\n }\n if (displayName != null) {\n _json[\"displayName\"] = displayName;\n }\n if (fccId != null) {\n _json[\"fccId\"] = fccId;\n }\n if (grants != null) {\n _json[\"grants\"] = grants.map((value) => (value).toJson()).toList();\n }\n if (name != null) {\n _json[\"name\"] = name;\n }\n if (preloadedConfig != null) {\n _json[\"preloadedConfig\"] = (preloadedConfig).toJson();\n }\n if (serialNumber != null) {\n _json[\"serialNumber\"] = serialNumber;\n }\n if (state != null) {\n _json[\"state\"] = state;\n }\n return _json;\n }\n}\n\n\/\/\/ Information about the device's air interface.\nclass SasPortalDeviceAirInterface {\n \/\/\/ This field specifies the radio access technology that is used for the\n \/\/\/ CBSD.\n \/\/\/\n \/\/\/ Conditional\n \/\/\/ Possible string values are:\n \/\/\/ - \"RADIO_TECHNOLOGY_UNSPECIFIED\"\n \/\/\/ - \"E_UTRA\"\n \/\/\/ - \"CAMBIUM_NETWORKS\"\n \/\/\/ - \"FOUR_G_BBW_SAA_1\"\n \/\/\/ - \"NR\"\n \/\/\/ - \"DOODLE_CBRS\"\n \/\/\/ - \"CW\"\n \/\/\/ - \"REDLINE\"\n \/\/\/ - \"TARANA_WIRELESS\"\n core.String radioTechnology;\n\n \/\/\/ This field is related to the radioTechnology field and provides the air\n \/\/\/ interface specification that the CBSD is compliant with at the time of\n \/\/\/ registration.\n \/\/\/\n \/\/\/ Optional\n core.String supportedSpec;\n\n SasPortalDeviceAirInterface();\n\n SasPortalDeviceAirInterface.fromJson(core.Map _json) {\n if (_json.containsKey(\"radioTechnology\")) {\n radioTechnology = _json[\"radioTechnology\"];\n }\n if (_json.containsKey(\"supportedSpec\")) {\n supportedSpec = _json[\"supportedSpec\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (radioTechnology != null) {\n _json[\"radioTechnology\"] = radioTechnology;\n }\n if (supportedSpec != null) {\n _json[\"supportedSpec\"] = supportedSpec;\n }\n return _json;\n }\n}\n\n\/\/\/ Information about the device configuration.\nclass SasPortalDeviceConfig {\n \/\/\/ Information about this device's air interface.\n SasPortalDeviceAirInterface airInterface;\n\n \/\/\/ The call sign of the device operator.\n core.String callSign;\n\n \/\/\/ FCC category of the device.\n \/\/\/ Possible string values are:\n \/\/\/ - \"DEVICE_CATEGORY_UNSPECIFIED\" : Unspecified device category.\n \/\/\/ - \"DEVICE_CATEGORY_A\" : Category A.\n \/\/\/ - \"DEVICE_CATEGORY_B\" : Category B.\n core.String category;\n\n \/\/\/ Installation parameters for the device.\n SasPortalInstallationParams installationParams;\n\n \/\/\/ Output-only. Whether the configuration has been signed by a CPI.\n core.bool isSigned;\n\n \/\/\/ Measurement reporting capabilities of the device.\n core.List measurementCapabilities;\n\n \/\/\/ Information about this device model.\n SasPortalDeviceModel model;\n\n \/\/\/ State of the configuration.\n \/\/\/ Possible string values are:\n \/\/\/ - \"DEVICE_CONFIG_STATE_UNSPECIFIED\"\n \/\/\/ - \"DRAFT\"\n \/\/\/ - \"FINAL\"\n core.String state;\n\n \/\/\/ Output-only. The last time the device configuration was edited.\n core.String updateTime;\n\n \/\/\/ The identifier of a device user.\n core.String userId;\n\n SasPortalDeviceConfig();\n\n SasPortalDeviceConfig.fromJson(core.Map _json) {\n if (_json.containsKey(\"airInterface\")) {\n airInterface =\n new SasPortalDeviceAirInterface.fromJson(_json[\"airInterface\"]);\n }\n if (_json.containsKey(\"callSign\")) {\n callSign = _json[\"callSign\"];\n }\n if (_json.containsKey(\"category\")) {\n category = _json[\"category\"];\n }\n if (_json.containsKey(\"installationParams\")) {\n installationParams =\n new SasPortalInstallationParams.fromJson(_json[\"installationParams\"]);\n }\n if (_json.containsKey(\"isSigned\")) {\n isSigned = _json[\"isSigned\"];\n }\n if (_json.containsKey(\"measurementCapabilities\")) {\n measurementCapabilities =\n (_json[\"measurementCapabilities\"] as core.List).cast();\n }\n if (_json.containsKey(\"model\")) {\n model = new SasPortalDeviceModel.fromJson(_json[\"model\"]);\n }\n if (_json.containsKey(\"state\")) {\n state = _json[\"state\"];\n }\n if (_json.containsKey(\"updateTime\")) {\n updateTime = _json[\"updateTime\"];\n }\n if (_json.containsKey(\"userId\")) {\n userId = _json[\"userId\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (airInterface != null) {\n _json[\"airInterface\"] = (airInterface).toJson();\n }\n if (callSign != null) {\n _json[\"callSign\"] = callSign;\n }\n if (category != null) {\n _json[\"category\"] = category;\n }\n if (installationParams != null) {\n _json[\"installationParams\"] = (installationParams).toJson();\n }\n if (isSigned != null) {\n _json[\"isSigned\"] = isSigned;\n }\n if (measurementCapabilities != null) {\n _json[\"measurementCapabilities\"] = measurementCapabilities;\n }\n if (model != null) {\n _json[\"model\"] = (model).toJson();\n }\n if (state != null) {\n _json[\"state\"] = state;\n }\n if (updateTime != null) {\n _json[\"updateTime\"] = updateTime;\n }\n if (userId != null) {\n _json[\"userId\"] = userId;\n }\n return _json;\n }\n}\n\n\/\/\/ Device grant. It is an authorization provided by the Spectrum\n\/\/\/ Access System to a device to transmit using specified operating\n\/\/\/ parameters after a successful heartbeat by the device.\nclass SasPortalDeviceGrant {\n \/\/\/ Type of channel used.\n \/\/\/ Possible string values are:\n \/\/\/ - \"CHANNEL_TYPE_UNSPECIFIED\"\n \/\/\/ - \"CHANNEL_TYPE_GAA\"\n \/\/\/ - \"CHANNEL_TYPE_PAL\"\n core.String channelType;\n\n \/\/\/ The expiration time of the grant.\n core.String expireTime;\n\n \/\/\/ The transmission frequency range.\n SasPortalFrequencyRange frequencyRange;\n\n \/\/\/ Maximum Equivalent Isotropically Radiated Power (EIRP) permitted\n \/\/\/ by the grant. The maximum EIRP is in units of dBm\/MHz. The\n \/\/\/ value of maxEirp represents the average (RMS) EIRP that would be\n \/\/\/ measured by the procedure defined in FCC part 96.41(e)(3).\n core.double maxEirp;\n\n \/\/\/ The DPA move lists on which this grant appears.\n core.List moveList;\n\n \/\/\/ State of the grant.\n \/\/\/ Possible string values are:\n \/\/\/ - \"GRANT_STATE_UNSPECIFIED\"\n \/\/\/ - \"GRANT_STATE_GRANTED\" : The grant has been granted but the device is not\n \/\/\/ heartbeating on it.\n \/\/\/ - \"GRANT_STATE_TERMINATED\" : The grant has been terminated by the SAS.\n \/\/\/ - \"GRANT_STATE_SUSPENDED\" : The grant has been suspended by the SAS.\n \/\/\/ - \"GRANT_STATE_AUTHORIZED\" : The device is currently transmitting.\n \/\/\/ - \"GRANT_STATE_EXPIRED\" : The grant has expired.\n core.String state;\n\n \/\/\/ If the grant is suspended, the reason(s) for suspension.\n core.List suspensionReason;\n\n SasPortalDeviceGrant();\n\n SasPortalDeviceGrant.fromJson(core.Map _json) {\n if (_json.containsKey(\"channelType\")) {\n channelType = _json[\"channelType\"];\n }\n if (_json.containsKey(\"expireTime\")) {\n expireTime = _json[\"expireTime\"];\n }\n if (_json.containsKey(\"frequencyRange\")) {\n frequencyRange =\n new SasPortalFrequencyRange.fromJson(_json[\"frequencyRange\"]);\n }\n if (_json.containsKey(\"maxEirp\")) {\n maxEirp = _json[\"maxEirp\"].toDouble();\n }\n if (_json.containsKey(\"moveList\")) {\n moveList = (_json[\"moveList\"] as core.List)\n .map(\n (value) => new SasPortalDpaMoveList.fromJson(value))\n .toList();\n }\n if (_json.containsKey(\"state\")) {\n state = _json[\"state\"];\n }\n if (_json.containsKey(\"suspensionReason\")) {\n suspensionReason =\n (_json[\"suspensionReason\"] as core.List).cast();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (channelType != null) {\n _json[\"channelType\"] = channelType;\n }\n if (expireTime != null) {\n _json[\"expireTime\"] = expireTime;\n }\n if (frequencyRange != null) {\n _json[\"frequencyRange\"] = (frequencyRange).toJson();\n }\n if (maxEirp != null) {\n _json[\"maxEirp\"] = maxEirp;\n }\n if (moveList != null) {\n _json[\"moveList\"] = moveList.map((value) => (value).toJson()).toList();\n }\n if (state != null) {\n _json[\"state\"] = state;\n }\n if (suspensionReason != null) {\n _json[\"suspensionReason\"] = suspensionReason;\n }\n return _json;\n }\n}\n\n\/\/\/ Information about the model of the device.\nclass SasPortalDeviceModel {\n \/\/\/ The firmware version of the device.\n core.String firmwareVersion;\n\n \/\/\/ The hardware version of the device.\n core.String hardwareVersion;\n\n \/\/\/ The name of the device model.\n core.String name;\n\n \/\/\/ The software version of the device.\n core.String softwareVersion;\n\n \/\/\/ The name of the device vendor.\n core.String vendor;\n\n SasPortalDeviceModel();\n\n SasPortalDeviceModel.fromJson(core.Map _json) {\n if (_json.containsKey(\"firmwareVersion\")) {\n firmwareVersion = _json[\"firmwareVersion\"];\n }\n if (_json.containsKey(\"hardwareVersion\")) {\n hardwareVersion = _json[\"hardwareVersion\"];\n }\n if (_json.containsKey(\"name\")) {\n name = _json[\"name\"];\n }\n if (_json.containsKey(\"softwareVersion\")) {\n softwareVersion = _json[\"softwareVersion\"];\n }\n if (_json.containsKey(\"vendor\")) {\n vendor = _json[\"vendor\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (firmwareVersion != null) {\n _json[\"firmwareVersion\"] = firmwareVersion;\n }\n if (hardwareVersion != null) {\n _json[\"hardwareVersion\"] = hardwareVersion;\n }\n if (name != null) {\n _json[\"name\"] = name;\n }\n if (softwareVersion != null) {\n _json[\"softwareVersion\"] = softwareVersion;\n }\n if (vendor != null) {\n _json[\"vendor\"] = vendor;\n }\n return _json;\n }\n}\n\n\/\/\/ An entry in a DPA's move list.\nclass SasPortalDpaMoveList {\n \/\/\/ The ID of the DPA.\n core.String dpaId;\n\n \/\/\/ The frequency range that the move list affects.\n SasPortalFrequencyRange frequencyRange;\n\n SasPortalDpaMoveList();\n\n SasPortalDpaMoveList.fromJson(core.Map _json) {\n if (_json.containsKey(\"dpaId\")) {\n dpaId = _json[\"dpaId\"];\n }\n if (_json.containsKey(\"frequencyRange\")) {\n frequencyRange =\n new SasPortalFrequencyRange.fromJson(_json[\"frequencyRange\"]);\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (dpaId != null) {\n _json[\"dpaId\"] = dpaId;\n }\n if (frequencyRange != null) {\n _json[\"frequencyRange\"] = (frequencyRange).toJson();\n }\n return _json;\n }\n}\n\n\/\/\/ A generic empty message that you can re-use to avoid defining duplicated\n\/\/\/ empty messages in your APIs. A typical example is to use it as the request\n\/\/\/ or the response type of an API method. For instance:\n\/\/\/\n\/\/\/ service Foo {\n\/\/\/ rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n\/\/\/ }\n\/\/\/\n\/\/\/ The JSON representation for `Empty` is empty JSON object `{}`.\nclass SasPortalEmpty {\n SasPortalEmpty();\n\n SasPortalEmpty.fromJson(core.Map _json) {}\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n return _json;\n }\n}\n\n\/\/\/ Frequency range from `low_frequency` to `high_frequency`.\nclass SasPortalFrequencyRange {\n \/\/\/ The highest frequency of the frequency range in MHz.\n core.double highFrequencyMhz;\n\n \/\/\/ The lowest frequency of the frequency range in MHz.\n core.double lowFrequencyMhz;\n\n SasPortalFrequencyRange();\n\n SasPortalFrequencyRange.fromJson(core.Map _json) {\n if (_json.containsKey(\"highFrequencyMhz\")) {\n highFrequencyMhz = _json[\"highFrequencyMhz\"].toDouble();\n }\n if (_json.containsKey(\"lowFrequencyMhz\")) {\n lowFrequencyMhz = _json[\"lowFrequencyMhz\"].toDouble();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (highFrequencyMhz != null) {\n _json[\"highFrequencyMhz\"] = highFrequencyMhz;\n }\n if (lowFrequencyMhz != null) {\n _json[\"lowFrequencyMhz\"] = lowFrequencyMhz;\n }\n return _json;\n }\n}\n\n\/\/\/ Request for GenerateSecret method]\n\/\/\/ [spectrum.sas.portal.v1alpha1.DeviceManager.GenerateSecret].\nclass SasPortalGenerateSecretRequest {\n SasPortalGenerateSecretRequest();\n\n SasPortalGenerateSecretRequest.fromJson(core.Map _json) {}\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n return _json;\n }\n}\n\n\/\/\/ Response for GenerateSecret method.\nclass SasPortalGenerateSecretResponse {\n \/\/\/ The secret generated by the string and used by\n \/\/\/ [ValidateInstaller] method.\n core.String secret;\n\n SasPortalGenerateSecretResponse();\n\n SasPortalGenerateSecretResponse.fromJson(core.Map _json) {\n if (_json.containsKey(\"secret\")) {\n secret = _json[\"secret\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (secret != null) {\n _json[\"secret\"] = secret;\n }\n return _json;\n }\n}\n\n\/\/\/ Request message for `GetPolicy` method.\nclass SasPortalGetPolicyRequest {\n \/\/\/ Required. The resource for which the policy is being requested.\n core.String resource;\n\n SasPortalGetPolicyRequest();\n\n SasPortalGetPolicyRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"resource\")) {\n resource = _json[\"resource\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (resource != null) {\n _json[\"resource\"] = resource;\n }\n return _json;\n }\n}\n\n\/\/\/ Information about the device installation parameters.\nclass SasPortalInstallationParams {\n \/\/\/ Boresight direction of the horizontal plane of the antenna in\n \/\/\/ degrees with respect to true north. The value of this parameter\n \/\/\/ is an integer with a value between 0 and 359 inclusive. A value\n \/\/\/ of 0 degrees means true north; a value of 90 degrees means\n \/\/\/ east. This parameter is optional for Category A devices and\n \/\/\/ conditional for Category B devices.\n core.int antennaAzimuth;\n\n \/\/\/ 3-dB antenna beamwidth of the antenna in the horizontal-plane in\n \/\/\/ degrees. This parameter is an unsigned integer having a value\n \/\/\/ between 0 and 360 (degrees) inclusive; it is optional for\n \/\/\/ Category A devices and conditional for Category B devices.\n core.int antennaBeamwidth;\n\n \/\/\/ Antenna downtilt in degrees and is an integer with a value\n \/\/\/ between -90 and +90 inclusive; a negative value means the antenna\n \/\/\/ is tilted up (above horizontal). This parameter is optional for\n \/\/\/ Category A devices and conditional for Category B devices.\n core.int antennaDowntilt;\n\n \/\/\/ Peak antenna gain in dBi. This parameter is an integer with a\n \/\/\/ value between -127 and +128 (dBi) inclusive.\n core.int antennaGain;\n\n \/\/\/ If an external antenna is used, the antenna model is optionally\n \/\/\/ provided in this field. The string has a maximum length of 128\n \/\/\/ octets.\n core.String antennaModel;\n\n \/\/\/ If present, this parameter specifies whether the CBSD is a CPE-CBSD or\n \/\/\/ not.\n core.bool cpeCbsdIndication;\n\n \/\/\/ This parameter is the maximum device EIRP in units of dBm\/10MHz\n \/\/\/ and is an integer with a value between -127 and +47 (dBm\/10 MHz)\n \/\/\/ inclusive. If not included, SAS interprets it as maximum\n \/\/\/ allowable EIRP in units of dBm\/10MHz for device category.\n core.int eirpCapability;\n\n \/\/\/ Device antenna height in meters. When the heightType parameter\n \/\/\/ value is \"AGL\", the antenna height should be given relative to\n \/\/\/ ground level. When the heightType parameter value is \"AMSL\", it\n \/\/\/ is given with respect to WGS84 datum.\n core.double height;\n\n \/\/\/ Specifies how the height is measured.\n \/\/\/ Possible string values are:\n \/\/\/ - \"HEIGHT_TYPE_UNSPECIFIED\" : Unspecified height type.\n \/\/\/ - \"HEIGHT_TYPE_AGL\" : AGL height is measured relative to the ground level.\n \/\/\/ - \"HEIGHT_TYPE_AMSL\" : AMSL height is measured relative to the mean sea\n \/\/\/ level.\n core.String heightType;\n\n \/\/\/ A positive number in meters to indicate accuracy of the device\n \/\/\/ antenna horizontal location. This optional parameter should only\n \/\/\/ be present if its value is less than the FCC requirement of 50\n \/\/\/ meters.\n core.double horizontalAccuracy;\n\n \/\/\/ Whether the device antenna is indoor or not. True: indoor. False:\n \/\/\/ outdoor.\n core.bool indoorDeployment;\n\n \/\/\/ Latitude of the device antenna location in degrees relative to\n \/\/\/ the WGS 84 datum. The allowed range is from -90.000000 to\n \/\/\/ +90.000000. Positive values represent latitudes north of the\n \/\/\/ equator; negative values south of the equator.\n core.double latitude;\n\n \/\/\/ Longitude of the device antenna location. in degrees relative to\n \/\/\/ the WGS 84 datum. The allowed range is from -180.000000 to\n \/\/\/ +180.000000. Positive values represent longitudes east of the\n \/\/\/ prime meridian; negative values west of the prime\n \/\/\/ meridian.\n core.double longitude;\n\n \/\/\/ A positive number in meters to indicate accuracy of the device\n \/\/\/ antenna vertical location. This optional parameter should only be\n \/\/\/ present if its value is less than the FCC requirement of 3\n \/\/\/ meters.\n core.double verticalAccuracy;\n\n SasPortalInstallationParams();\n\n SasPortalInstallationParams.fromJson(core.Map _json) {\n if (_json.containsKey(\"antennaAzimuth\")) {\n antennaAzimuth = _json[\"antennaAzimuth\"];\n }\n if (_json.containsKey(\"antennaBeamwidth\")) {\n antennaBeamwidth = _json[\"antennaBeamwidth\"];\n }\n if (_json.containsKey(\"antennaDowntilt\")) {\n antennaDowntilt = _json[\"antennaDowntilt\"];\n }\n if (_json.containsKey(\"antennaGain\")) {\n antennaGain = _json[\"antennaGain\"];\n }\n if (_json.containsKey(\"antennaModel\")) {\n antennaModel = _json[\"antennaModel\"];\n }\n if (_json.containsKey(\"cpeCbsdIndication\")) {\n cpeCbsdIndication = _json[\"cpeCbsdIndication\"];\n }\n if (_json.containsKey(\"eirpCapability\")) {\n eirpCapability = _json[\"eirpCapability\"];\n }\n if (_json.containsKey(\"height\")) {\n height = _json[\"height\"].toDouble();\n }\n if (_json.containsKey(\"heightType\")) {\n heightType = _json[\"heightType\"];\n }\n if (_json.containsKey(\"horizontalAccuracy\")) {\n horizontalAccuracy = _json[\"horizontalAccuracy\"].toDouble();\n }\n if (_json.containsKey(\"indoorDeployment\")) {\n indoorDeployment = _json[\"indoorDeployment\"];\n }\n if (_json.containsKey(\"latitude\")) {\n latitude = _json[\"latitude\"].toDouble();\n }\n if (_json.containsKey(\"longitude\")) {\n longitude = _json[\"longitude\"].toDouble();\n }\n if (_json.containsKey(\"verticalAccuracy\")) {\n verticalAccuracy = _json[\"verticalAccuracy\"].toDouble();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (antennaAzimuth != null) {\n _json[\"antennaAzimuth\"] = antennaAzimuth;\n }\n if (antennaBeamwidth != null) {\n _json[\"antennaBeamwidth\"] = antennaBeamwidth;\n }\n if (antennaDowntilt != null) {\n _json[\"antennaDowntilt\"] = antennaDowntilt;\n }\n if (antennaGain != null) {\n _json[\"antennaGain\"] = antennaGain;\n }\n if (antennaModel != null) {\n _json[\"antennaModel\"] = antennaModel;\n }\n if (cpeCbsdIndication != null) {\n _json[\"cpeCbsdIndication\"] = cpeCbsdIndication;\n }\n if (eirpCapability != null) {\n _json[\"eirpCapability\"] = eirpCapability;\n }\n if (height != null) {\n _json[\"height\"] = height;\n }\n if (heightType != null) {\n _json[\"heightType\"] = heightType;\n }\n if (horizontalAccuracy != null) {\n _json[\"horizontalAccuracy\"] = horizontalAccuracy;\n }\n if (indoorDeployment != null) {\n _json[\"indoorDeployment\"] = indoorDeployment;\n }\n if (latitude != null) {\n _json[\"latitude\"] = latitude;\n }\n if (longitude != null) {\n _json[\"longitude\"] = longitude;\n }\n if (verticalAccuracy != null) {\n _json[\"verticalAccuracy\"] = verticalAccuracy;\n }\n return _json;\n }\n}\n\n\/\/\/ Response for `ListCustomers`.\nclass SasPortalListCustomersResponse {\n \/\/\/ The list of customers that\n \/\/\/ match the request.\n core.List customers;\n\n \/\/\/ A pagination token returned from a previous call to ListCustomers method\n \/\/\/ that indicates from\n \/\/\/ where listing should continue. If the field is missing or empty, it means\n \/\/\/ there are no more customers.\n core.String nextPageToken;\n\n SasPortalListCustomersResponse();\n\n SasPortalListCustomersResponse.fromJson(core.Map _json) {\n if (_json.containsKey(\"customers\")) {\n customers = (_json[\"customers\"] as core.List)\n .map(\n (value) => new SasPortalCustomer.fromJson(value))\n .toList();\n }\n if (_json.containsKey(\"nextPageToken\")) {\n nextPageToken = _json[\"nextPageToken\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (customers != null) {\n _json[\"customers\"] = customers.map((value) => (value).toJson()).toList();\n }\n if (nextPageToken != null) {\n _json[\"nextPageToken\"] = nextPageToken;\n }\n return _json;\n }\n}\n\n\/\/\/ Response for ListDevices method.\nclass SasPortalListDevicesResponse {\n \/\/\/ The devices that match the request.\n core.List devices;\n\n \/\/\/ A pagination token returned from a previous call to ListDevices method\n \/\/\/ that indicates from where listing should continue. If the field\n \/\/\/ is missing or empty, it means there is no more devices.\n core.String nextPageToken;\n\n SasPortalListDevicesResponse();\n\n SasPortalListDevicesResponse.fromJson(core.Map _json) {\n if (_json.containsKey(\"devices\")) {\n devices = (_json[\"devices\"] as core.List)\n .map((value) => new SasPortalDevice.fromJson(value))\n .toList();\n }\n if (_json.containsKey(\"nextPageToken\")) {\n nextPageToken = _json[\"nextPageToken\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (devices != null) {\n _json[\"devices\"] = devices.map((value) => (value).toJson()).toList();\n }\n if (nextPageToken != null) {\n _json[\"nextPageToken\"] = nextPageToken;\n }\n return _json;\n }\n}\n\n\/\/\/ Response for ListNodes method.\nclass SasPortalListNodesResponse {\n \/\/\/ A pagination token returned from a previous call to\n \/\/\/ ListNodes method\n \/\/\/ that indicates from where listing should continue. If the field is missing\n \/\/\/ or empty, it means there is no more nodes.\n core.String nextPageToken;\n\n \/\/\/ The nodes that match the request.\n core.List nodes;\n\n SasPortalListNodesResponse();\n\n SasPortalListNodesResponse.fromJson(core.Map _json) {\n if (_json.containsKey(\"nextPageToken\")) {\n nextPageToken = _json[\"nextPageToken\"];\n }\n if (_json.containsKey(\"nodes\")) {\n nodes = (_json[\"nodes\"] as core.List)\n .map((value) => new SasPortalNode.fromJson(value))\n .toList();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (nextPageToken != null) {\n _json[\"nextPageToken\"] = nextPageToken;\n }\n if (nodes != null) {\n _json[\"nodes\"] = nodes.map((value) => (value).toJson()).toList();\n }\n return _json;\n }\n}\n\n\/\/\/ Request for MoveDevice method.\nclass SasPortalMoveDeviceRequest {\n \/\/\/ Required. The name of the new parent resource (Node or Customer) to\n \/\/\/ reparent the device under.\n core.String destination;\n\n SasPortalMoveDeviceRequest();\n\n SasPortalMoveDeviceRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"destination\")) {\n destination = _json[\"destination\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (destination != null) {\n _json[\"destination\"] = destination;\n }\n return _json;\n }\n}\n\n\/\/\/ Request for MoveNode method.\nclass SasPortalMoveNodeRequest {\n \/\/\/ Required. The name of the new parent resource node or Customer) to\n \/\/\/ reparent the node under.\n core.String destination;\n\n SasPortalMoveNodeRequest();\n\n SasPortalMoveNodeRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"destination\")) {\n destination = _json[\"destination\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (destination != null) {\n _json[\"destination\"] = destination;\n }\n return _json;\n }\n}\n\n\/\/\/ The Node.\nclass SasPortalNode {\n \/\/\/ The node's display name.\n core.String displayName;\n\n \/\/\/ Output only. Resource name.\n core.String name;\n\n \/\/\/ User ids used by the devices belonging to this node.\n core.List sasUserIds;\n\n SasPortalNode();\n\n SasPortalNode.fromJson(core.Map _json) {\n if (_json.containsKey(\"displayName\")) {\n displayName = _json[\"displayName\"];\n }\n if (_json.containsKey(\"name\")) {\n name = _json[\"name\"];\n }\n if (_json.containsKey(\"sasUserIds\")) {\n sasUserIds = (_json[\"sasUserIds\"] as core.List).cast();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (displayName != null) {\n _json[\"displayName\"] = displayName;\n }\n if (name != null) {\n _json[\"name\"] = name;\n }\n if (sasUserIds != null) {\n _json[\"sasUserIds\"] = sasUserIds;\n }\n return _json;\n }\n}\n\n\/\/\/ This resource represents a long-running operation that is the result of a\n\/\/\/ network API call.\nclass SasPortalOperation {\n \/\/\/ If the value is `false`, it means the operation is still in progress.\n \/\/\/ If `true`, the operation is completed, and either `error` or `response` is\n \/\/\/ available.\n core.bool done;\n\n \/\/\/ The error result of the operation in case of failure or cancellation.\n SasPortalStatus error;\n\n \/\/\/ Service-specific metadata associated with the operation. It typically\n \/\/\/ contains progress information and common metadata such as create time.\n \/\/\/ Some services might not provide such metadata. Any method that returns a\n \/\/\/ long-running operation should document the metadata type, if any.\n \/\/\/\n \/\/\/ The values for Object must be JSON objects. It can consist of `num`,\n \/\/\/ `String`, `bool` and `null` as well as `Map` and `List` values.\n core.Map metadata;\n\n \/\/\/ The server-assigned name, which is only unique within the same service\n \/\/\/ that\n \/\/\/ originally returns it. If you use the default HTTP mapping, the\n \/\/\/ `name` should be a resource name ending with `operations\/{unique_id}`.\n core.String name;\n\n \/\/\/ The normal response of the operation in case of success. If the original\n \/\/\/ method returns no data on success, such as `Delete`, the response is\n \/\/\/ `google.protobuf.Empty`. If the original method is standard\n \/\/\/ `Get`\/`Create`\/`Update`, the response should be the resource. For other\n \/\/\/ methods, the response should have the type `XxxResponse`, where `Xxx`\n \/\/\/ is the original method name. For example, if the original method name\n \/\/\/ is `TakeSnapshot()`, the inferred response type is\n \/\/\/ `TakeSnapshotResponse`.\n \/\/\/\n \/\/\/ The values for Object must be JSON objects. It can consist of `num`,\n \/\/\/ `String`, `bool` and `null` as well as `Map` and `List` values.\n core.Map response;\n\n SasPortalOperation();\n\n SasPortalOperation.fromJson(core.Map _json) {\n if (_json.containsKey(\"done\")) {\n done = _json[\"done\"];\n }\n if (_json.containsKey(\"error\")) {\n error = new SasPortalStatus.fromJson(_json[\"error\"]);\n }\n if (_json.containsKey(\"metadata\")) {\n metadata =\n (_json[\"metadata\"] as core.Map).cast();\n }\n if (_json.containsKey(\"name\")) {\n name = _json[\"name\"];\n }\n if (_json.containsKey(\"response\")) {\n response =\n (_json[\"response\"] as core.Map).cast();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (done != null) {\n _json[\"done\"] = done;\n }\n if (error != null) {\n _json[\"error\"] = (error).toJson();\n }\n if (metadata != null) {\n _json[\"metadata\"] = metadata;\n }\n if (name != null) {\n _json[\"name\"] = name;\n }\n if (response != null) {\n _json[\"response\"] = response;\n }\n return _json;\n }\n}\n\n\/\/\/ Defines an access control policy to the resources.\nclass SasPortalPolicy {\n core.List assignments;\n\n \/\/\/ The [etag] is used for optimistic concurrency control as a way to\n \/\/\/ help prevent simultaneous updates of a policy from overwriting\n \/\/\/ each other. It is strongly suggested that systems make use of\n \/\/\/ the [etag] in the read-modify-write cycle to perform policy\n \/\/\/ updates in order to avoid race conditions: An [etag] is returned\n \/\/\/ in the response to [GetPolicy], and systems are expected to put\n \/\/\/ that etag in the request to [SetPolicy] to ensure that their\n \/\/\/ change will be applied to the same version of the policy.\n \/\/\/\n \/\/\/ If no [etag] is provided in the call to [SetPolicy], then the\n \/\/\/ existing policy is overwritten blindly.\n core.String etag;\n core.List get etagAsBytes {\n return convert.base64.decode(etag);\n }\n\n set etagAsBytes(core.List _bytes) {\n etag =\n convert.base64.encode(_bytes).replaceAll(\"\/\", \"_\").replaceAll(\"+\", \"-\");\n }\n\n SasPortalPolicy();\n\n SasPortalPolicy.fromJson(core.Map _json) {\n if (_json.containsKey(\"assignments\")) {\n assignments = (_json[\"assignments\"] as core.List)\n .map(\n (value) => new SasPortalAssignment.fromJson(value))\n .toList();\n }\n if (_json.containsKey(\"etag\")) {\n etag = _json[\"etag\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (assignments != null) {\n _json[\"assignments\"] =\n assignments.map((value) => (value).toJson()).toList();\n }\n if (etag != null) {\n _json[\"etag\"] = etag;\n }\n return _json;\n }\n}\n\n\/\/\/ Request message for `SetPolicy` method.\nclass SasPortalSetPolicyRequest {\n \/\/\/ Required. The policy to be applied to the `resource`.\n SasPortalPolicy policy;\n\n \/\/\/ Required. The resource for which the policy is being specified. This\n \/\/\/ policy\n \/\/\/ replaces any existing policy.\n core.String resource;\n\n SasPortalSetPolicyRequest();\n\n SasPortalSetPolicyRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"policy\")) {\n policy = new SasPortalPolicy.fromJson(_json[\"policy\"]);\n }\n if (_json.containsKey(\"resource\")) {\n resource = _json[\"resource\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (policy != null) {\n _json[\"policy\"] = (policy).toJson();\n }\n if (resource != null) {\n _json[\"resource\"] = resource;\n }\n return _json;\n }\n}\n\n\/\/\/ Request for SignDevice method.\nclass SasPortalSignDeviceRequest {\n \/\/\/ Required. The device to sign.\n \/\/\/ The device fields name, fcc_id and serial_number must be set.\n \/\/\/ The user_id field must be set.\n SasPortalDevice device;\n\n SasPortalSignDeviceRequest();\n\n SasPortalSignDeviceRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"device\")) {\n device = new SasPortalDevice.fromJson(_json[\"device\"]);\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (device != null) {\n _json[\"device\"] = (device).toJson();\n }\n return _json;\n }\n}\n\n\/\/\/ The `Status` type defines a logical error model that is suitable for\n\/\/\/ different programming environments, including REST APIs and RPC APIs. It is\n\/\/\/ used by [gRPC](https:\/\/github.com\/grpc). Each `Status` message contains\n\/\/\/ three pieces of data: error code, error message, and error details.\n\/\/\/\n\/\/\/ You can find out more about this error model and how to work with it in the\n\/\/\/ [API Design Guide](https:\/\/cloud.google.com\/apis\/design\/errors).\nclass SasPortalStatus {\n \/\/\/ The status code, which should be an enum value of google.rpc.Code.\n core.int code;\n\n \/\/\/ A list of messages that carry the error details. There is a common set of\n \/\/\/ message types for APIs to use.\n \/\/\/\n \/\/\/ The values for Object must be JSON objects. It can consist of `num`,\n \/\/\/ `String`, `bool` and `null` as well as `Map` and `List` values.\n core.List> details;\n\n \/\/\/ A developer-facing error message, which should be in English. Any\n \/\/\/ user-facing error message should be localized and sent in the\n \/\/\/ google.rpc.Status.details field, or localized by the client.\n core.String message;\n\n SasPortalStatus();\n\n SasPortalStatus.fromJson(core.Map _json) {\n if (_json.containsKey(\"code\")) {\n code = _json[\"code\"];\n }\n if (_json.containsKey(\"details\")) {\n details = (_json[\"details\"] as core.List)\n .map>(\n (value) => (value as core.Map).cast())\n .toList();\n }\n if (_json.containsKey(\"message\")) {\n message = _json[\"message\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (code != null) {\n _json[\"code\"] = code;\n }\n if (details != null) {\n _json[\"details\"] = details;\n }\n if (message != null) {\n _json[\"message\"] = message;\n }\n return _json;\n }\n}\n\n\/\/\/ Request message for `TestPermissions` method.\nclass SasPortalTestPermissionsRequest {\n \/\/\/ The set of permissions to check for the `resource`.\n core.List permissions;\n\n \/\/\/ Required. The resource for which the permissions are being requested.\n core.String resource;\n\n SasPortalTestPermissionsRequest();\n\n SasPortalTestPermissionsRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"permissions\")) {\n permissions = (_json[\"permissions\"] as core.List).cast();\n }\n if (_json.containsKey(\"resource\")) {\n resource = _json[\"resource\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (permissions != null) {\n _json[\"permissions\"] = permissions;\n }\n if (resource != null) {\n _json[\"resource\"] = resource;\n }\n return _json;\n }\n}\n\n\/\/\/ Response message for `TestPermissions` method.\nclass SasPortalTestPermissionsResponse {\n \/\/\/ A set of permissions that the caller is allowed.\n core.List permissions;\n\n SasPortalTestPermissionsResponse();\n\n SasPortalTestPermissionsResponse.fromJson(core.Map _json) {\n if (_json.containsKey(\"permissions\")) {\n permissions = (_json[\"permissions\"] as core.List).cast();\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (permissions != null) {\n _json[\"permissions\"] = permissions;\n }\n return _json;\n }\n}\n\n\/\/\/ Request for UpdateSignedDevice method.\nclass SasPortalUpdateSignedDeviceRequest {\n \/\/\/ Required. The JSON Web Token signed using a CPI private key. Payload\n \/\/\/ must be the JSON encoding\n \/\/\/ of the device. The user_id field must be set.\n core.String encodedDevice;\n core.List get encodedDeviceAsBytes {\n return convert.base64.decode(encodedDevice);\n }\n\n set encodedDeviceAsBytes(core.List _bytes) {\n encodedDevice =\n convert.base64.encode(_bytes).replaceAll(\"\/\", \"_\").replaceAll(\"+\", \"-\");\n }\n\n \/\/\/ Required. Unique installer ID (CPI ID) from the Certified Professional\n \/\/\/ Installers database.\n core.String installerId;\n\n SasPortalUpdateSignedDeviceRequest();\n\n SasPortalUpdateSignedDeviceRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"encodedDevice\")) {\n encodedDevice = _json[\"encodedDevice\"];\n }\n if (_json.containsKey(\"installerId\")) {\n installerId = _json[\"installerId\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (encodedDevice != null) {\n _json[\"encodedDevice\"] = encodedDevice;\n }\n if (installerId != null) {\n _json[\"installerId\"] = installerId;\n }\n return _json;\n }\n}\n\n\/\/\/ Request for ValidateInstaller method.\nclass SasPortalValidateInstallerRequest {\n \/\/\/ Required. JSON Web Token signed using a CPI private key. Payload\n \/\/\/ must include a \"secret\" claim whose value is the secret.\n core.String encodedSecret;\n\n \/\/\/ Required. Unique installer id (cpiId) from the Certified\n \/\/\/ Professional Installers database.\n core.String installerId;\n\n \/\/\/ Required. Secret returned by the GenerateSecret method.\n core.String secret;\n\n SasPortalValidateInstallerRequest();\n\n SasPortalValidateInstallerRequest.fromJson(core.Map _json) {\n if (_json.containsKey(\"encodedSecret\")) {\n encodedSecret = _json[\"encodedSecret\"];\n }\n if (_json.containsKey(\"installerId\")) {\n installerId = _json[\"installerId\"];\n }\n if (_json.containsKey(\"secret\")) {\n secret = _json[\"secret\"];\n }\n }\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n if (encodedSecret != null) {\n _json[\"encodedSecret\"] = encodedSecret;\n }\n if (installerId != null) {\n _json[\"installerId\"] = installerId;\n }\n if (secret != null) {\n _json[\"secret\"] = secret;\n }\n return _json;\n }\n}\n\n\/\/\/ Response for ValidateInstaller method]\n\/\/\/ [spectrum.sas.portal.v1alpha1.DeviceManager.ValidateInstaller].\nclass SasPortalValidateInstallerResponse {\n SasPortalValidateInstallerResponse();\n\n SasPortalValidateInstallerResponse.fromJson(core.Map _json) {}\n\n core.Map toJson() {\n final core.Map _json =\n new core.Map();\n return _json;\n }\n}\n","avg_line_length":31.597144931,"max_line_length":80,"alphanum_fraction":0.6520127727} {"size":5278,"ext":"dart","lang":"Dart","max_stars_count":85.0,"content":"import 'dart:math';\nimport 'dart:ui';\n\nimport 'package:flutter\/cupertino.dart';\nimport 'package:flutter\/foundation.dart';\nimport 'package:flutter\/material.dart';\n\nclass EasyWaving extends StatefulWidget {\n final double progress; \/\/\u8bbe\u7f6e\u5c31\u663e\u793a\uff0c\u9ed8\u8ba40.5\n final Text text; \/\/\u8fdb\u5ea6\u6570\u5b57 \u81ea\u5b9a\u4e49\n final bool isHidenProgress; \/\/\u9690\u85cf\u6587\u5b57\n final double radius; \/\/\u5706\u5708\u534a\u5f84\n final Color color; \/\/\u6ce2\u6d6a\u989c\u8272\n final Color circleColor; \/\/\u5706\u5706\u989c\u8272\n \/\/\/ \u5927\u6ce2\u6d6a\n \/\/\/ double progress; \/\/\u8bbe\u7f6e\u5c31\u663e\u793a\uff0c\u9ed8\u8ba40.5\n \/\/\/ Text text; \/\/\u8fdb\u5ea6\u6570\u5b57 \u81ea\u5b9a\u4e49\n \/\/\/ bool isHidenProgress;\/\/\u9690\u85cf\u6587\u5b57\n \/\/\/ Color color; \/\/\u6ce2\u6d6a\u989c\u8272\n \/\/\/ Color circleColor; \/\/\u5706\u5706\u989c\u8272\n \/\/\/ \u66f4\u591a\u4fe1\u606f\u89c1\u4ed3\u5e93\uff1ahttps:\/\/github.com\/ifgyong\/flutter_easyHub\n EasyWaving(\n {Key key,\n this.progress,\n this.text,\n this.circleColor,\n this.color,\n this.radius,\n this.isHidenProgress})\n : super(key: key);\n _EasyWaving createState() => _EasyWaving();\n}\n\nclass _EasyWaving extends State\n with SingleTickerProviderStateMixin {\n AnimationController _animationController;\n\n @override\n void initState() {\n _animationController = AnimationController(\n vsync: this,\n duration: Duration(seconds: 80),\n lowerBound: 0,\n upperBound: 10000.0)\n ..repeat();\n\n super.initState();\n }\n\n @override\n Widget build(BuildContext context) {\n double radius = widget.radius == null ? 60 : widget.radius * 2;\n\n AnimatedBuilder builder = AnimatedBuilder(\n animation: _animationController,\n builder: (context, child) {\n List list = List();\n Positioned positioned = Positioned(\n left: 0,\n top: 0,\n width: radius,\n height: radius,\n child: CustomPaint(\n painter: EasyWavingPainter(\n color: widget.color,\n circleColor: widget.circleColor,\n radius: radius,\n value: _animationController.value,\n progress: widget.progress == null ? 0.5 : widget.progress),\n ));\n list.add(positioned);\n if (widget.text == null) {\n if (widget.isHidenProgress != true) {\n Positioned text = Positioned(\n child: Container(\n alignment: Alignment.center,\n child: Text(\n '${(widget.progress == null ? 50.0 : (widget.progress > 1.0 ? 100.0 : widget.progress * 100)).toStringAsFixed(2)}%',\n style: TextStyle(fontSize: 13, decoration: TextDecoration.none),\n ),\n ));\n list.add(text);\n }\n } else {\n if (widget.isHidenProgress != true) {\n Positioned text = Positioned(\n child: Container(\n alignment: Alignment.center,\n child: widget.text,\n ));\n list.add(text);\n }\n }\n return Container(\n width: radius,\n height: radius,\n child: Stack(\n children: list,\n ),\n );\n },\n );\n return Container(width: radius, height: radius, child: builder);\n }\n\n @override\n void dispose() {\n _animationController.stop(canceled: true);\n _animationController.dispose();\n super.dispose();\n }\n}\n\nclass EasyWavingPainter extends CustomPainter {\n double radius;\n double value; \/\/\u79fb\u52a8\u504f\u79fb\u91cf\n double progress; \/\/\u8fdb\u5ea6 0.0--1.0\u4e4b\u95f4\n double waveHeight;\n Color color; \/\/\u6ce2\u6d6a\u989c\u8272\n Color circleColor; \/\/\u5706\u5708\u989c\u8272\n EasyWavingPainter(\n {Key key,\n @required this.progress,\n this.radius,\n this.value,\n this.waveHeight,\n this.color,\n this.circleColor});\n\n Paint _paint;\n Paint _paintCircle;\n Path _path = Path();\n @override\n void paint(Canvas canvas, Size size) {\n if (_paint == null) {\n _paint = Paint()\n ..color = this.color == null\n ? Colors.lightBlueAccent.withOpacity(0.8)\n : this.color\n ..style = PaintingStyle.fill\n ..strokeWidth = 2.0;\n }\n if (_paintCircle == null) {\n _paintCircle = Paint()\n ..color =\n this.circleColor == null ? Colors.lightBlueAccent : this.circleColor\n ..style = PaintingStyle.stroke\n ..strokeWidth = 2.0;\n }\n if (size == null) {\n size = Size(100, 100);\n }\n\n _path.addArc(Rect.fromLTWH(0, 0, size.width, size.height), 0, 360);\n canvas.clipPath(_path); \/\/\n \/\/\u5706\u5708\n canvas.drawCircle(\n Offset(size.width \/ 2, size.height \/ 2), radius \/ 2.0, _paintCircle);\n _path.reset();\n _path.moveTo(0.0, size.height \/ 2);\n canvas.save();\n canvas.restore();\n int count = 100000;\n \/\/\u6d6a\u9ad8\n double waveHeight =\n this.waveHeight == null ? this.radius \/ 120.0 * 3.5 : this.waveHeight;\n double pro = this.progress == null ? 0.4 : 1 - this.progress; \/\/\u8fdb\u5ea6\n double dis = 0.08 \/ (this.radius \/ 80.0); \/\/\u6ce2\u6d6a\u7684\u534a\u5f84\u8ba1\u7b97\u5f97\u51fa\u7684\n for (double i = 0.0, j = 0; i < count; i++) {\n j += dis;\n double x = i + this.value * radius \/ 200 - count + size.width;\n double y = size.height * pro + (sin(j) * waveHeight);\n _path.lineTo(x, y);\n }\n _path.lineTo(size.width, size.height);\n _path.lineTo(0, size.height);\n _path.lineTo(0, 0);\n _path.close();\n canvas.drawPath(_path, _paint);\n }\n\n @override\n bool shouldRepaint(CustomPainter oldDelegate) {\n return true;\n }\n}\n","avg_line_length":28.2245989305,"max_line_length":132,"alphanum_fraction":0.5769230769} {"size":5761,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:audioplayers\/audio_cache.dart';\nimport 'package:fcaih_mm\/views\/home.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter\/widgets.dart';\nimport '..\/custom_widgets\/game_image_list.dart';\nimport '..\/constants\/strings.dart';\nimport '..\/constants\/dimensions.dart';\nimport '..\/controllers\/matching_game_controller.dart';\nimport '..\/interfaces\/on_correct_answer.dart';\nimport 'home.dart';\n\nclass MatchingGameView extends StatefulWidget {\n @override\n State createState() => _MatchingGameViewState();\n}\n\nclass _MatchingGameViewState extends State\n implements OnCorrectAnswer {\n final String _gameHint = \"\u0642\u0645 \u0628\u062a\u0648\u0635\u064a\u0644 \u0627\u0644\u0635\u0648\u0631\u0629 \\n \u0627\u0644\u0645\u0646\u0627\u0633\u0628\u0629 \u0644\u0644\u062d\u0631\u0641\";\n int _score = 0;\n final String _scoreText = \"\u0645\u062c\u0645\u0648\u0639 \u0646\u0642\u0627\u0637\u0643\";\n final MatchingGameController _gameController = MatchingGameController();\n String _letterToShow;\n GameImagesList _gameImagesList;\n final AudioCache _assetsAudioPlayer = AudioCache();\n _MatchingGameViewState() {\n _gameImagesList = GameImagesList(this);\n }\n\n @override\n void initState() {\n super.initState();\n _letterToShow = _gameController.letterToShow;\n }\n\n @override\n Widget build(BuildContext context) {\n return Container(\n alignment: Alignment.center,\n decoration: BoxDecoration(\n image: DecorationImage(\n image: AssetImage(MATCHING_BG_IMG), fit: BoxFit.cover)),\n child: Scaffold(\n backgroundColor: Colors.transparent,\n body: Column(\n children: [\n Container(\n margin: const EdgeInsets.only(top: MATCHING_TITLE_TOP_MARG),\n alignment: Alignment.center,\n child: Row(\n children: [\n Container(\n margin: const EdgeInsets.only(left: BACK_ARROW_LEFT_MARG_MATCHING),\n child: IconButton(\n onPressed: _onBackBtnPressed,\n icon: Image(\n image: AssetImage(BACK_ARROW_ICON),\n width: BACK_ARROW_ICON_SIZE,\n height: BACK_ARROW_ICON_SIZE,\n )),\n ),\n Expanded(\n child: Row(\n children: [\n Text(_gameHint,\n style: TextStyle(\n fontFamily: FONT_FAMILY,\n fontSize: MATCHING_TITLE_SIZE,\n color: Colors.black))\n ],\n mainAxisAlignment: MainAxisAlignment.center,\n ),\n ),\n ],\n mainAxisAlignment: MainAxisAlignment.start,\n ),\n ),\n Container(\n margin: const EdgeInsets.only(\n top: MATCHING_SCORE_TOP_MARG, left: MATCHING_SCORE_LEFT_MARG),\n alignment: Alignment.center,\n child: Text(_scoreText + \" : $_score\",\n style: TextStyle(\n fontFamily: FONT_FAMILY,\n fontSize: MATCHING_TITLE_SIZE,\n color: Colors.black)),\n ),\n Expanded(\n child: Center(\n child: Row(children: [\n Container(\n child: DragTarget(\n builder: (context, candidates, rejected) {\n return Text(_letterToShow,\n style: TextStyle(\n fontFamily: FONT_FAMILY,\n fontSize: GAME_ANSWERS_TEXT_SIZE,\n fontWeight: FontWeight.bold,\n color: Colors.black));\n },\n onWillAccept: (data) => true,\n ),\n margin: const EdgeInsets.only(left: ANSWER_LEFT_MARG)),\n Expanded(\n child: Row(children: [\n Container(\n child: _gameImagesList,\n height: MediaQuery.of(context).size.height \/ 2,\n width: MediaQuery.of(context).size.width \/ 2)\n ], mainAxisAlignment: MainAxisAlignment.end),\n )\n ], mainAxisAlignment: MainAxisAlignment.start),\n )),\n ],\n )),\n );\n }\n\n @override\n void onCorrectAnswer(int index) {\n setState(() {\n _score++;\n _letterToShow = _gameController.letterToShow;\n });\n if (_score == _gameController.numOfPlays) {\n _playApplauseSound();\n _showCongratsDialog();\n }\n }\n\n void _onBackBtnPressed() {\n Navigator.pop(context);\n Navigator.push(\n context, MaterialPageRoute(builder: (context) => HomePage()));\n }\n\n void _showCongratsDialog() {\n showDialog(\n context: context,\n builder: (context) => AlertDialog(\n title: Text(\n CONGRATS_TEXT,\n style: TextStyle(\n fontFamily: FONT_FAMILY,\n fontSize: GAME_OVER_DIALOG_TEXT_SIZE),\n ),\n actions: [\n FlatButton(\n onPressed: () {\n Navigator.pop(context);\n Navigator.push(context,\n MaterialPageRoute(builder: (context) => HomePage()));\n },\n child: Text(FINISH_GAME_TEXT))\n ],\n ));\n }\n\n void _playApplauseSound() => _assetsAudioPlayer.play(APPLAUSE_SOUND);\n}\n","avg_line_length":35.7826086957,"max_line_length":89,"alphanum_fraction":0.5052942198} {"size":235,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'package:flutter\/material.dart';\n\nclass SplashScreen extends StatelessWidget {\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n body: Center(\n child: Text(\"Waiting...\"),\n ),\n );\n }\n}\n","avg_line_length":18.0769230769,"max_line_length":44,"alphanum_fraction":0.6340425532} {"size":2644,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"\/\/ Copyright 2017 The Chromium Authors. All rights reserved.\n\/\/ Use of this source code is governed by a BSD-style license that can be\n\/\/ found in the LICENSE file.\n\nimport 'dart:async';\nimport 'package:flutter_tools\/src\/device.dart';\nimport 'package:flutter_tools\/src\/resident_runner.dart';\nimport 'package:mockito\/mockito.dart';\n\nimport 'src\/common.dart';\nimport 'src\/context.dart';\n\nclass TestRunner extends ResidentRunner {\n TestRunner(List devices)\n : super(devices);\n\n bool hasHelpBeenPrinted = false;\n String receivedCommand;\n\n @override\n Future cleanupAfterSignal() => null;\n\n @override\n Future cleanupAtFinish() => null;\n\n @override\n Future handleTerminalCommand(String code) async {\n receivedCommand = code;\n }\n\n @override\n void printHelp({ bool details }) {\n hasHelpBeenPrinted = true;\n }\n\n @override\n Future run({\n Completer connectionInfoCompleter,\n Completer appStartedCompleter,\n String route,\n bool shouldBuild = true,\n }) => null;\n}\n\nvoid main() {\n TestRunner createTestRunner() {\n \/\/ TODO(jacobr): make these tests run with `trackWidgetCreation: true` as\n \/\/ well as the default flags.\n return new TestRunner(\n [new FlutterDevice(new MockDevice(), trackWidgetCreation: false)],\n );\n }\n\n group('keyboard input handling', () {\n testUsingContext('single help character', () async {\n final TestRunner testRunner = createTestRunner();\n expect(testRunner.hasHelpBeenPrinted, isFalse);\n await testRunner.processTerminalInput('h');\n expect(testRunner.hasHelpBeenPrinted, isTrue);\n });\n testUsingContext('help character surrounded with newlines', () async {\n final TestRunner testRunner = createTestRunner();\n expect(testRunner.hasHelpBeenPrinted, isFalse);\n await testRunner.processTerminalInput('\\nh\\n');\n expect(testRunner.hasHelpBeenPrinted, isTrue);\n });\n testUsingContext('reload character with trailing newline', () async {\n final TestRunner testRunner = createTestRunner();\n expect(testRunner.receivedCommand, isNull);\n await testRunner.processTerminalInput('r\\n');\n expect(testRunner.receivedCommand, equals('r'));\n });\n testUsingContext('newlines', () async {\n final TestRunner testRunner = createTestRunner();\n expect(testRunner.receivedCommand, isNull);\n await testRunner.processTerminalInput('\\n\\n');\n expect(testRunner.receivedCommand, equals(''));\n });\n });\n}\n\nclass MockDevice extends Mock implements Device {\n MockDevice() {\n when(isSupported()).thenReturn(true);\n }\n}\n","avg_line_length":30.3908045977,"max_line_length":87,"alphanum_fraction":0.708774584} {"size":2261,"ext":"dart","lang":"Dart","max_stars_count":2.0,"content":"\/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\/\n\nRegExp pipelineOptionsRegExp =\n RegExp(r'''--([A-z0-9]*)\\s+([A-z0-9\\\/\\\"\\'\\*\\-\\:\\;\\.]*)''');\n\nconst keyValueGroupCount = 2;\n\nString getGroupValue(RegExpMatch match, int groupNum) {\n return match.group(groupNum)?.trim() ?? '';\n}\n\n\/\/\/ Parses pipeline options string (--key value) to the key-value map\nMap? parsePipelineOptions(String pipelineOptions) {\n final Map result = {};\n if (pipelineOptions.isEmpty) {\n return result;\n }\n final matches = pipelineOptionsRegExp.allMatches(pipelineOptions);\n if (matches.isEmpty) {\n return null;\n }\n final hasError = matches.where((match) {\n return match.groupCount != keyValueGroupCount ||\n getGroupValue(match, 1).isEmpty ||\n getGroupValue(match, 2).isEmpty;\n }).isNotEmpty;\n if (hasError) {\n return null;\n }\n for (var match in matches) {\n final key = getGroupValue(match, 1);\n final value = getGroupValue(match, 2);\n result[key] = value;\n }\n var optionsCopy = pipelineOptions;\n for (var element in result.entries) {\n optionsCopy = optionsCopy.replaceAll('--${element.key}', '');\n optionsCopy = optionsCopy.replaceAll(element.value, '');\n }\n if (optionsCopy.trim().isNotEmpty) {\n return null;\n }\n return result;\n}\n\n\/\/\/ Converts pipeline options to --key value string\nString pipelineOptionsToString(Map pipelineOptions) {\n return pipelineOptions.entries.map((e) => '--${e.key} ${e.value}').join(' ');\n}\n","avg_line_length":34.2575757576,"max_line_length":79,"alphanum_fraction":0.6979212738} {"size":64,"ext":"dart","lang":"Dart","max_stars_count":2677.0,"content":"export 'package:open_api\/v3.dart';\n\nexport 'documentable.dart';\n","avg_line_length":16.0,"max_line_length":34,"alphanum_fraction":0.765625} {"size":2587,"ext":"dart","lang":"Dart","max_stars_count":122.0,"content":"import \"dart:collection\";\nimport \"package:fast_immutable_collections\/fast_immutable_collections.dart\";\nimport \"package:meta\/meta.dart\";\n\nimport \"iset.dart\";\nimport \"set_extension.dart\";\n\n\/\/\/ The [UnmodifiableSetFromISet] is a relatively safe, unmodifiable [Set] view that is built from\n\/\/\/ an [ISet] or another [Set]. The construction of the [UnmodifiableSetFromISet] is very fast,\n\/\/\/ since it makes no copies of the given set items, but just uses it directly.\n\/\/\/\n\/\/\/ If you try to use methods that modify the [UnmodifiableSetFromISet], like [add],\n\/\/\/ it will throw an [UnsupportedError].\n\/\/\/\n\/\/\/ If you create it from an [ISet], it is also very fast to lock the [UnmodifiableSetFromISet]\n\/\/\/ back into an [ISet].\n\/\/\/\n\/\/\/
\n\/\/\/\n\/\/\/ ## How does it compare to [UnmodifiableSetView] from `package:collection`?\n\/\/\/\n\/\/\/ The only different between an [UnmodifiableSetFromISet] and an [UnmodifiableSetView] is that\n\/\/\/ [UnmodifiableSetFromISet] accepts both a [Set] and an [ISet]. Note both are views, so they\n\/\/\/ are fast to create, but if you create them from a regular [Set] and then modify that original\n\/\/\/ [Set], you will also be modifying the views. Also note, if you create an\n\/\/\/ [UnmodifiableSetFromISet] from an [ISt], then it's totally safe because the original [ISet]\n\/\/\/ can't be modified.\n\/\/\/\n\/\/\/ See also: [ModifiableSetFromISet]\n\/\/\/\n@immutable\nclass UnmodifiableSetFromISet with SetMixin implements Set, CanBeEmpty {\n final ISet? _iSet;\n final Set? _set;\n\n \/\/\/ Create an unmodifiable [Set] view of type [UnmodifiableSetFromISet], from an [iset].\n UnmodifiableSetFromISet(ISet? iset)\n : _iSet = iset ?? ISetImpl.empty(),\n _set = null;\n\n \/\/\/ Create an unmodifiable [Set] view of type [UnmodifiableSetFromISet], from another [Set].\n UnmodifiableSetFromISet.fromSet(Set set)\n : _iSet = null,\n _set = set;\n\n @override\n bool add(T value) => throw UnsupportedError(\"Set is unmodifiable.\");\n\n @override\n bool contains(covariant T? element) => _iSet?.contains(element) ?? _set!.contains(element);\n\n @override\n T? lookup(covariant T element) =>\n _iSet != null && _iSet!.contains(element) || _set != null && _set!.contains(element)\n ? element\n : null;\n\n @override\n bool remove(covariant Object value) => throw UnsupportedError(\"Set is unmodifiable.\");\n\n @override\n Iterator get iterator => _set?.iterator ?? _iSet!.iterator;\n\n @override\n Set toSet() => _set ?? _iSet!.toSet();\n\n @override\n int get length => _iSet?.length ?? _set!.length;\n\n ISet get lock => _iSet ?? _set!.lock;\n}\n","avg_line_length":35.9305555556,"max_line_length":98,"alphanum_fraction":0.6950135292} {"size":3146,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\nimport 'package:firebase_auth\/firebase_auth.dart';\nimport 'package:flutter\/cupertino.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter_session\/flutter_session.dart';\nimport 'package:quizapp2\/services\/auth.dart';\nimport 'package:quizapp2\/views\/home.dart';\nimport 'package:quizapp2\/views\/result_user.dart';\nimport 'package:quizapp2\/views\/rules.dart';\nimport 'package:quizapp2\/views\/signin.dart';\n\nString _userEmail;\n\nclass NavigationDrawerWidget extends StatelessWidget {\n final AuthService _authService = AuthService();\n final padding = EdgeInsets.symmetric(horizontal: 20);\n final FirebaseAuth _auth = FirebaseAuth.instance;\n\n\n Future firebaseGetEmail() async {\n final FirebaseUser user = await _auth.currentUser();\n await FlutterSession().set(\"email\", user.email);\n _userEmail = await FlutterSession().get(\"email\");\n \/\/ return emailUser;\n }\n\n @override\n Widget build(BuildContext context) {\n return Drawer(\n child: Material(\n color: Color.fromRGBO(50, 75, 205, 1),\n child: ListView(\n padding: padding,\n children: [\n const SizedBox(height: 50),\n buildMenuItem(\n text: 'Home',\n icon: Icons.people,\n onClicked: () => selectedItem(context, 0),\n ),\n const SizedBox(height: 16),\n buildMenuItem(\n text: 'Read the Rules',\n icon: Icons.border_color,\n onClicked: () => selectedItem(context, 1),\n ),\n const SizedBox(height: 16),\n buildMenuItem(\n text: 'User Result',\n icon: Icons.assessment,\n onClicked: () => selectedItem(context, 2),\n ),\n const SizedBox(height: 16),\n Divider(color: Colors.white70),\n const SizedBox(height: 16),\n buildMenuItem(\n text: 'Logout',\n icon: Icons.lock,\n onClicked: () => selectedItem(context, 3),\n ),\n const SizedBox(height: 16),\n ],\n ),\n ),\n );\n }\n\n Widget buildMenuItem({\n String text, IconData icon,VoidCallback onClicked,\n }) {\n final color = Colors.white;\n final hoverColor = Colors.white70;\n\n return ListTile(\n leading: Icon(icon, color: color),\n title: Text(text, style: TextStyle(color: color)),\n hoverColor: hoverColor,\n onTap: onClicked,\n );\n }\n\n void selectedItem(BuildContext context, int index) async{\n switch (index) {\n case 0:\n Navigator.of(context).push(MaterialPageRoute(\n builder: (context) => Home(),\n ));\n break;\n case 1:\n Navigator.of(context).push(MaterialPageRoute(\n builder: (context) => Rules(),\n ));\n break;\n case 2:\n Navigator.of(context).push(MaterialPageRoute(\n builder: (context) => ResultUser(_userEmail),\n ));\n break;\n case 3:\n await _authService.signOut();\n Navigator.of(context).push(MaterialPageRoute(\n builder: (context) => SignIn(),\n ));\n break;\n }\n }\n}","avg_line_length":29.4018691589,"max_line_length":59,"alphanum_fraction":0.5867768595} {"size":1103,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:analyzer\/dart\/analysis\/results.dart';\nimport 'package:analyzer\/dart\/ast\/ast.dart';\nimport 'package:analyzer\/dart\/ast\/syntactic_entity.dart';\nimport 'package:source_span\/source_span.dart';\n\n\/\/\/ Returns [SourceSpan] with information about original code for [node] from [source]\nSourceSpan nodeLocation({\n required SyntacticEntity node,\n required ResolvedUnitResult source,\n bool withCommentOrMetadata = false,\n}) {\n final offset = !withCommentOrMetadata && node is AnnotatedNode\n ? node.firstTokenAfterCommentAndMetadata.offset\n : node.offset;\n final end = node.end;\n\n final offsetLocation = source.unit?.lineInfo?.getLocation(offset);\n final endLocation = source.unit?.lineInfo?.getLocation(end);\n\n return SourceSpan(\n SourceLocation(\n offset,\n sourceUrl: source.path,\n line: offsetLocation?.lineNumber,\n column: offsetLocation?.columnNumber,\n ),\n SourceLocation(\n end,\n sourceUrl: source.path,\n line: endLocation?.lineNumber,\n column: endLocation?.columnNumber,\n ),\n source.content!.substring(offset, end),\n );\n}\n","avg_line_length":30.6388888889,"max_line_length":86,"alphanum_fraction":0.725294651} {"size":2979,"ext":"dart","lang":"Dart","max_stars_count":252.0,"content":"import 'dart:collection';\n\nimport 'package:nomdebebe\/models\/filter.dart';\nimport 'package:nomdebebe\/models\/name.dart';\nimport 'package:nomdebebe\/models\/sex.dart';\nimport 'package:nomdebebe\/providers\/names_provider.dart';\n\nclass NamesRepository {\n final NamesProvider _namesProvider;\n\n NamesRepository(this._namesProvider);\n\n Future> getNames(\n {List? filters, int skip = 0, int count = 20}) {\n return _namesProvider.getNames(filters ?? List.empty(), skip, count);\n }\n\n \/\/Future getNextUndecidedName({List? filters}) async {\n \/\/List names = await _namesProvider.getNames(\n \/\/[LikeFilter.undecided] + (filters ?? List.empty()), 0, 1);\n \/\/if (names.isEmpty) return null;\n \/\/return names[0];\n \/\/}\n\n Future likeName(Name name) async {\n await _namesProvider.setNameLike(name.id, true);\n return name.makeLiked();\n }\n\n Future dislikeName(Name name) async {\n await _namesProvider.setNameLike(name.id, false);\n return name.makeDisliked();\n }\n\n Future undecideName(Name name) async {\n await _namesProvider.setNameLike(name.id, null);\n return name.makeUndecided();\n }\n\n Future countTotalNames({List? filters}) {\n return _namesProvider.countNames(filters ?? List.empty());\n }\n\n Future countUndecidedNames({List? filters}) {\n return _namesProvider\n .countNames([LikeFilter.undecided] + (filters ?? List.empty()));\n }\n\n Future countLikedNames({List? filters}) {\n return _namesProvider\n .countNames([LikeFilter.liked] + (filters ?? List.empty()));\n }\n\n Future countDislikedNames({List? filters}) {\n return _namesProvider\n .countNames([LikeFilter.disliked] + (filters ?? List.empty()));\n }\n\n Future> getRankedLikedNames({List? filters}) {\n return _namesProvider.getRankedLikedNames(\n filters ?? List.empty(), 0, 1000000);\n }\n\n Future rankLikedNames(List sortedIds) {\n return _namesProvider.rankLikedNames(sortedIds);\n }\n\n Future swapLikedNamesRanks(int oldRank, int newRank,\n {List? filters}) async {\n List ids = await _namesProvider.getRankedLikedNameIds(\n filters ?? List.empty(), 0, 1000000);\n int id = ids.removeAt(oldRank);\n ids.insert(newRank > oldRank ? newRank - 1 : newRank, id);\n return _namesProvider.rankLikedNames(ids);\n }\n\n Future factoryReset() {\n return _namesProvider.factoryReset();\n }\n\n Future> getDecadeCounts() {\n return _namesProvider.getDecadeCounts();\n }\n\n Future> getNameDecadeCounts(int id) {\n return _namesProvider.getNameDecadeCounts(id);\n }\n\n Future findName(String name, Sex sex) async {\n List names = await _namesProvider\n .getNames([ExactNameFilter(name), SexFilter.fromSex(sex)], 0, 1);\n if (names.isEmpty) return null;\n return names.first;\n }\n}\n","avg_line_length":31.03125,"max_line_length":80,"alphanum_fraction":0.6958710977} {"size":6281,"ext":"dart","lang":"Dart","max_stars_count":74.0,"content":"\/\/ Copyright 2019 terrier989@gmail.com\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\/*\nSome source code in this file was adopted from 'dart:html' in Dart SDK. See:\n https:\/\/github.com\/dart-lang\/sdk\/tree\/master\/tools\/dom\n\nThe source code adopted from 'dart:html' had the following license:\n\n Copyright 2012, the Dart project authors. All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and\/or other materials provided\n with the distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived\n from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*\/\n\npart of universal_html.internal;\n\ntypedef EventListener = Function(Event event);\n\nclass Event {\n \/\/\/ This event is being handled by the event target.\n \/\/\/\n \/\/\/ ## Other resources\n \/\/\/\n \/\/\/ * [Target phase](http:\/\/www.w3.org\/TR\/DOM-Level-3-Events\/#target-phase)\n \/\/\/ from W3C.\n static const int AT_TARGET = 2;\n\n \/\/\/ This event is bubbling up through the target's ancestors.\n \/\/\/\n \/\/\/ ## Other resources\n \/\/\/\n \/\/\/ * [Bubble phase](http:\/\/www.w3.org\/TR\/DOM-Level-3-Events\/#bubble-phase)\n \/\/\/ from W3C.\n static const int BUBBLING_PHASE = 3;\n\n \/\/\/ This event is propagating through the target's ancestors, starting from the\n \/\/\/ document.\n \/\/\/\n \/\/\/ ## Other resources\n \/\/\/\n \/\/\/ * [Bubble phase](http:\/\/www.w3.org\/TR\/DOM-Level-3-Events\/#bubble-phase)\n \/\/\/ from W3C.\n static const int CAPTURING_PHASE = 1;\n\n \/\/\/ This event is propagating through the target's ancestors, starting from the document.\n static const int _INITIAL_PHASE = 0;\n\n final String type;\n\n final bool? bubbles;\n\n final bool? cancelable;\n\n EventTarget? _currentTarget;\n\n bool _defaultPrevented = false;\n\n \/\/ ignore: prefer_final_fields\n int _eventPhase = _INITIAL_PHASE;\n\n final bool _stoppedImmediatePropagation = false;\n\n bool _stoppedPropagation = false;\n\n final num? timeStamp;\n\n \/\/ In JS, canBubble and cancelable are technically required parameters to\n \/\/ init*Event. In practice, though, if they aren't provided they simply\n \/\/ default to false (since that's Boolean(undefined)).\n \/\/\n \/\/ Contrary to JS, we default canBubble and cancelable to true, since that's\n \/\/ what people want most of the time anyway.\n EventTarget? _target;\n final bool? composed;\n\n factory Event(String type, {bool canBubble = true, bool cancelable = true}) {\n return Event.eventType(\n 'Event',\n type,\n canBubble: canBubble,\n cancelable: cancelable,\n );\n }\n\n \/\/\/ Creates a new Event object of the specified type.\n \/\/\/\n \/\/\/ This is analogous to document.createEvent.\n \/\/\/ Normally events should be created via their constructors, if available.\n \/\/\/\n \/\/\/ var e = new Event.type('MouseEvent', 'mousedown', true, true);\n \/\/\/\n factory Event.eventType(String type, String name,\n {bool canBubble = true, bool cancelable = true}) {\n switch (type) {\n case 'KeyboardEvent':\n return KeyboardEvent(name);\n case 'MessageEvent':\n return MessageEvent(name);\n case 'MouseEvent':\n return MouseEvent(name);\n case 'PopStateEvent':\n return PopStateEvent(name);\n case 'TouchEvent':\n return TouchEvent._(name);\n default:\n return Event.internal(type);\n }\n }\n\n @visibleForTesting\n Event.internal(\n this.type, {\n EventTarget? target,\n this.composed = false,\n bool canBubble = true,\n this.cancelable = true,\n }) : bubbles = canBubble,\n _target = target,\n timeStamp = DateTime.now().microsecondsSinceEpoch;\n\n EventTarget? get currentTarget => _currentTarget;\n\n bool get defaultPrevented => _defaultPrevented;\n\n int get eventPhase => _eventPhase;\n\n bool? get isTrusted => true;\n\n \/\/\/ A pointer to the element whose CSS selector matched within which an event\n \/\/\/ was fired. If this Event was not associated with any Event delegation,\n \/\/\/ accessing this value will throw an [UnsupportedError].\n Element get matchingTarget {\n throw UnsupportedError('No matchingTarget');\n }\n\n List get path => const [];\n\n EventTarget? get target => _target;\n\n List composedPath() => const [];\n\n void internalSetTarget(EventTarget? target) {\n _target = target;\n }\n\n void preventDefault() {\n if (cancelable ?? true) {\n _defaultPrevented = true;\n }\n }\n\n void stopImmediatePropagation() {\n if (cancelable ?? true) {\n _stoppedPropagation = true;\n }\n }\n\n void stopPropagation() {\n if (cancelable ?? true) {\n _stoppedPropagation = true;\n }\n }\n}\n","avg_line_length":32.0459183673,"max_line_length":91,"alphanum_fraction":0.7032319694} {"size":953,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"\/\/ Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\n\/\/ SharedOptions=--enable-experiment=extension-methods\n\n\/\/ It is an error to have a setter and a getter in an extension where\n\/\/ the return type of the getter is not assignable to the argument type\n\/\/ of the setter.\nextension E1 on int {\n static int get property => 1;\n \/\/ ^^\n \/\/ [cfe] unspecified\n \/\/ ^^^^^^^^\n \/\/ [analyzer] STATIC_WARNING.MISMATCHED_GETTER_AND_SETTER_TYPES\n static void set property(String value) {}\n \/\/ ^^\n \/\/ [cfe] unspecified\n int get property2 => 1;\n \/\/ ^^\n \/\/ [cfe] unspecified\n \/\/ ^^^^^^^^^\n \/\/ [analyzer] STATIC_WARNING.MISMATCHED_GETTER_AND_SETTER_TYPES\n void set property2(String x) {}\n \/\/ ^^\n \/\/ [cfe] unspecified\n}\n\nvoid main() {}","avg_line_length":32.8620689655,"max_line_length":77,"alphanum_fraction":0.6400839454} {"size":33696,"ext":"dart","lang":"Dart","max_stars_count":3.0,"content":"\/\/ GENERATED CODE - DO NOT MODIFY BY HAND\n\npart of 'database.dart';\n\n\/\/ **************************************************************************\n\/\/ FloorGenerator\n\/\/ **************************************************************************\n\nclass $FloorFlutterDatabase {\n \/\/\/ Creates a database builder for a persistent database.\n \/\/\/ Once a database is built, you should keep a reference to it and re-use it.\n static _$FlutterDatabaseBuilder databaseBuilder(String name) =>\n _$FlutterDatabaseBuilder(name);\n\n \/\/\/ Creates a database builder for an in memory database.\n \/\/\/ Information stored in an in memory database disappears when the process is killed.\n \/\/\/ Once a database is built, you should keep a reference to it and re-use it.\n static _$FlutterDatabaseBuilder inMemoryDatabaseBuilder() =>\n _$FlutterDatabaseBuilder(null);\n}\n\nclass _$FlutterDatabaseBuilder {\n _$FlutterDatabaseBuilder(this.name);\n\n final String? name;\n\n final List _migrations = [];\n\n Callback? _callback;\n\n \/\/\/ Adds migrations to the builder.\n _$FlutterDatabaseBuilder addMigrations(List migrations) {\n _migrations.addAll(migrations);\n return this;\n }\n\n \/\/\/ Adds a database [Callback] to the builder.\n _$FlutterDatabaseBuilder addCallback(Callback callback) {\n _callback = callback;\n return this;\n }\n\n \/\/\/ Creates the database and initializes it.\n Future build() async {\n final path = name != null\n ? await sqfliteDatabaseFactory.getDatabasePath(name!)\n : ':memory:';\n final database = _$FlutterDatabase();\n database.database = await database.open(\n path,\n _migrations,\n _callback,\n );\n return database;\n }\n}\n\nclass _$FlutterDatabase extends FlutterDatabase {\n _$FlutterDatabase([StreamController? listener]) {\n changeListener = listener ?? StreamController.broadcast();\n }\n\n MHWalletDao? _walletDaoInstance;\n\n ContactAddressDao? _addressDaoInstance;\n\n NodeDao? _nodeDaoInstance;\n\n MCollectionTokenDao? _tokensDaoInstance;\n\n TransRecordModelDao? _transListDaoInstance;\n\n Future open(String path, List migrations,\n [Callback? callback]) async {\n final databaseOptions = sqflite.OpenDatabaseOptions(\n version: 1,\n onConfigure: (database) async {\n await database.execute('PRAGMA foreign_keys = ON');\n await callback?.onConfigure?.call(database);\n },\n onOpen: (database) async {\n await callback?.onOpen?.call(database);\n },\n onUpgrade: (database, startVersion, endVersion) async {\n await MigrationAdapter.runMigrations(\n database, startVersion, endVersion, migrations);\n\n await callback?.onUpgrade?.call(database, startVersion, endVersion);\n },\n onCreate: (database, version) async {\n await database.execute(\n 'CREATE TABLE IF NOT EXISTS `wallet_table` (`walletID` TEXT, `walletAaddress` TEXT, `pin` TEXT, `pinTip` TEXT, `createTime` TEXT, `updateTime` TEXT, `isChoose` INTEGER, `prvKey` TEXT, `pubKey` TEXT, `chainType` INTEGER, `leadType` INTEGER, `originType` INTEGER, `masterPubKey` TEXT, `descName` TEXT, PRIMARY KEY (`walletID`))');\n await database.execute(\n 'CREATE TABLE IF NOT EXISTS `nodes_table` (`content` TEXT NOT NULL, `chainType` INTEGER NOT NULL, `isChoose` INTEGER NOT NULL, `isDefault` INTEGER NOT NULL, `isMainnet` INTEGER NOT NULL, `chainID` INTEGER NOT NULL, PRIMARY KEY (`content`, `chainType`))');\n await database.execute(\n 'CREATE TABLE IF NOT EXISTS `contactAddress_table` (`address` TEXT NOT NULL, `coinType` INTEGER NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY (`address`))');\n await database.execute(\n 'CREATE TABLE IF NOT EXISTS `tokens_table` (`owner` TEXT, `contract` TEXT, `token` TEXT, `coinType` TEXT, `state` INTEGER, `decimals` INTEGER, `price` REAL, `balance` REAL, `digits` INTEGER, PRIMARY KEY (`owner`, `token`))');\n await database.execute(\n 'CREATE TABLE IF NOT EXISTS `translist_table` (`txid` TEXT, `toAdd` TEXT, `fromAdd` TEXT, `date` TEXT, `amount` TEXT, `remarks` TEXT, `fee` TEXT, `gasPrice` TEXT, `gasLimit` TEXT, `transStatus` INTEGER, `symbol` TEXT, `coinType` TEXT, `transType` INTEGER, `chainid` INTEGER, PRIMARY KEY (`txid`))');\n\n await callback?.onCreate?.call(database, version);\n },\n );\n return sqfliteDatabaseFactory.openDatabase(path, options: databaseOptions);\n }\n\n @override\n MHWalletDao get walletDao {\n return _walletDaoInstance ??= _$MHWalletDao(database, changeListener);\n }\n\n @override\n ContactAddressDao get addressDao {\n return _addressDaoInstance ??=\n _$ContactAddressDao(database, changeListener);\n }\n\n @override\n NodeDao get nodeDao {\n return _nodeDaoInstance ??= _$NodeDao(database, changeListener);\n }\n\n @override\n MCollectionTokenDao get tokensDao {\n return _tokensDaoInstance ??=\n _$MCollectionTokenDao(database, changeListener);\n }\n\n @override\n TransRecordModelDao get transListDao {\n return _transListDaoInstance ??=\n _$TransRecordModelDao(database, changeListener);\n }\n}\n\nclass _$MHWalletDao extends MHWalletDao {\n _$MHWalletDao(this.database, this.changeListener)\n : _queryAdapter = QueryAdapter(database, changeListener),\n _mHWalletInsertionAdapter = InsertionAdapter(\n database,\n 'wallet_table',\n (MHWallet item) => {\n 'walletID': item.walletID,\n 'walletAaddress': item.walletAaddress,\n 'pin': item.pin,\n 'pinTip': item.pinTip,\n 'createTime': item.createTime,\n 'updateTime': item.updateTime,\n 'isChoose':\n item.isChoose == null ? null : (item.isChoose! ? 1 : 0),\n 'prvKey': item.prvKey,\n 'pubKey': item.pubKey,\n 'chainType': item.chainType,\n 'leadType': item.leadType,\n 'originType': item.originType,\n 'masterPubKey': item.masterPubKey,\n 'descName': item.descName\n },\n changeListener),\n _mHWalletUpdateAdapter = UpdateAdapter(\n database,\n 'wallet_table',\n ['walletID'],\n (MHWallet item) => {\n 'walletID': item.walletID,\n 'walletAaddress': item.walletAaddress,\n 'pin': item.pin,\n 'pinTip': item.pinTip,\n 'createTime': item.createTime,\n 'updateTime': item.updateTime,\n 'isChoose':\n item.isChoose == null ? null : (item.isChoose! ? 1 : 0),\n 'prvKey': item.prvKey,\n 'pubKey': item.pubKey,\n 'chainType': item.chainType,\n 'leadType': item.leadType,\n 'originType': item.originType,\n 'masterPubKey': item.masterPubKey,\n 'descName': item.descName\n },\n changeListener),\n _mHWalletDeletionAdapter = DeletionAdapter(\n database,\n 'wallet_table',\n ['walletID'],\n (MHWallet item) => {\n 'walletID': item.walletID,\n 'walletAaddress': item.walletAaddress,\n 'pin': item.pin,\n 'pinTip': item.pinTip,\n 'createTime': item.createTime,\n 'updateTime': item.updateTime,\n 'isChoose':\n item.isChoose == null ? null : (item.isChoose! ? 1 : 0),\n 'prvKey': item.prvKey,\n 'pubKey': item.pubKey,\n 'chainType': item.chainType,\n 'leadType': item.leadType,\n 'originType': item.originType,\n 'masterPubKey': item.masterPubKey,\n 'descName': item.descName\n },\n changeListener);\n\n final sqflite.DatabaseExecutor database;\n\n final StreamController changeListener;\n\n final QueryAdapter _queryAdapter;\n\n final InsertionAdapter _mHWalletInsertionAdapter;\n\n final UpdateAdapter _mHWalletUpdateAdapter;\n\n final DeletionAdapter _mHWalletDeletionAdapter;\n\n @override\n Future findWalletByWalletID(String walletID) async {\n return _queryAdapter.query('SELECT * FROM wallet_table WHERE walletID = ?1',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?),\n arguments: [walletID]);\n }\n\n @override\n Future findChooseWallet() async {\n return _queryAdapter.query('SELECT * FROM wallet_table WHERE isChoose = 1',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?));\n }\n\n @override\n Future finDidChooseWallet() async {\n return _queryAdapter.query('SELECT * FROM wallet_table WHERE didChoose = 1',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?));\n }\n\n @override\n Future> findWalletsByChainType(int chainType) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM wallet_table WHERE chainType = ?1 ORDER BY \"index\"',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?),\n arguments: [chainType]);\n }\n\n @override\n Future> findWalletsByType(int originType) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM wallet_table WHERE originType = ?1 ORDER BY \"index\"',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?),\n arguments: [originType]);\n }\n\n @override\n Future> findWalletsByAddress(\n String walletAaddress, int chainType) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM wallet_table WHERE walletAaddress = ?1 and chainType = ?2',\n mapper: (Map row) => MHWallet(row['walletID'] as String?, row['walletAaddress'] as String?, row['pin'] as String?, row['pinTip'] as String?, row['createTime'] as String?, row['updateTime'] as String?, row['isChoose'] == null ? null : (row['isChoose'] as int) != 0, row['prvKey'] as String?, row['pubKey'] as String?, row['chainType'] as int?, row['leadType'] as int?, row['originType'] as int?, row['masterPubKey'] as String?, row['descName'] as String?),\n arguments: [walletAaddress, chainType]);\n }\n\n @override\n Future> findWalletsBySQL(String sql) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM wallet_table WHERE ?1 ORDER BY \"index\"',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?),\n arguments: [sql]);\n }\n\n @override\n Future> findAllWallets() async {\n return _queryAdapter.queryList(\n 'SELECT * FROM wallet_table ORDER BY \"index\"',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?));\n }\n\n @override\n Stream> findAllWalletsAsStream() {\n return _queryAdapter.queryListStream('SELECT * FROM wallet_table',\n mapper: (Map row) => MHWallet(\n row['walletID'] as String?,\n row['walletAaddress'] as String?,\n row['pin'] as String?,\n row['pinTip'] as String?,\n row['createTime'] as String?,\n row['updateTime'] as String?,\n row['isChoose'] == null ? null : (row['isChoose'] as int) != 0,\n row['prvKey'] as String?,\n row['pubKey'] as String?,\n row['chainType'] as int?,\n row['leadType'] as int?,\n row['originType'] as int?,\n row['masterPubKey'] as String?,\n row['descName'] as String?),\n queryableName: 'wallet_table',\n isView: false);\n }\n\n @override\n Future insertWallet(MHWallet wallet) async {\n await _mHWalletInsertionAdapter.insert(wallet, OnConflictStrategy.abort);\n }\n\n @override\n Future insertWallets(List wallet) async {\n await _mHWalletInsertionAdapter.insertList(\n wallet, OnConflictStrategy.abort);\n }\n\n @override\n Future updateWallet(MHWallet wallet) async {\n await _mHWalletUpdateAdapter.update(wallet, OnConflictStrategy.abort);\n }\n\n @override\n Future updateWallets(List wallet) async {\n await _mHWalletUpdateAdapter.updateList(wallet, OnConflictStrategy.abort);\n }\n\n @override\n Future deleteWallet(MHWallet wallet) async {\n await _mHWalletDeletionAdapter.delete(wallet);\n }\n\n @override\n Future deleteWallets(List wallet) async {\n await _mHWalletDeletionAdapter.deleteList(wallet);\n }\n}\n\nclass _$ContactAddressDao extends ContactAddressDao {\n _$ContactAddressDao(this.database, this.changeListener)\n : _queryAdapter = QueryAdapter(database),\n _contactAddressInsertionAdapter = InsertionAdapter(\n database,\n 'contactAddress_table',\n (ContactAddress item) => {\n 'address': item.address,\n 'coinType': item.coinType,\n 'name': item.name\n }),\n _contactAddressUpdateAdapter = UpdateAdapter(\n database,\n 'contactAddress_table',\n ['address'],\n (ContactAddress item) => {\n 'address': item.address,\n 'coinType': item.coinType,\n 'name': item.name\n }),\n _contactAddressDeletionAdapter = DeletionAdapter(\n database,\n 'contactAddress_table',\n ['address'],\n (ContactAddress item) => {\n 'address': item.address,\n 'coinType': item.coinType,\n 'name': item.name\n });\n\n final sqflite.DatabaseExecutor database;\n\n final StreamController changeListener;\n\n final QueryAdapter _queryAdapter;\n\n final InsertionAdapter _contactAddressInsertionAdapter;\n\n final UpdateAdapter _contactAddressUpdateAdapter;\n\n final DeletionAdapter _contactAddressDeletionAdapter;\n\n @override\n Future> findAddressType(int coinType) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM contactAddress_table WHERE coinType = ?1',\n mapper: (Map row) => ContactAddress(\n row['address'] as String,\n row['coinType'] as int,\n row['name'] as String),\n arguments: [coinType]);\n }\n\n @override\n Future insertAddress(ContactAddress model) async {\n await _contactAddressInsertionAdapter.insert(\n model, OnConflictStrategy.replace);\n }\n\n @override\n Future updateAddress(ContactAddress model) async {\n await _contactAddressUpdateAdapter.update(model, OnConflictStrategy.abort);\n }\n\n @override\n Future deleteAddress(ContactAddress model) async {\n await _contactAddressDeletionAdapter.delete(model);\n }\n}\n\nclass _$NodeDao extends NodeDao {\n _$NodeDao(this.database, this.changeListener)\n : _queryAdapter = QueryAdapter(database),\n _nodeModelInsertionAdapter = InsertionAdapter(\n database,\n 'nodes_table',\n (NodeModel item) => {\n 'content': item.content,\n 'chainType': item.chainType,\n 'isChoose': item.isChoose ? 1 : 0,\n 'isDefault': item.isDefault ? 1 : 0,\n 'isMainnet': item.isMainnet ? 1 : 0,\n 'chainID': item.chainID\n }),\n _nodeModelUpdateAdapter = UpdateAdapter(\n database,\n 'nodes_table',\n ['content', 'chainType'],\n (NodeModel item) => {\n 'content': item.content,\n 'chainType': item.chainType,\n 'isChoose': item.isChoose ? 1 : 0,\n 'isDefault': item.isDefault ? 1 : 0,\n 'isMainnet': item.isMainnet ? 1 : 0,\n 'chainID': item.chainID\n });\n\n final sqflite.DatabaseExecutor database;\n\n final StreamController changeListener;\n\n final QueryAdapter _queryAdapter;\n\n final InsertionAdapter _nodeModelInsertionAdapter;\n\n final UpdateAdapter _nodeModelUpdateAdapter;\n\n @override\n Future> queryNodeByIsChoose(bool isChoose) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM nodes_table WHERE isChoose = ?1',\n mapper: (Map row) => NodeModel(\n row['content'] as String,\n row['chainType'] as int,\n (row['isChoose'] as int) != 0,\n (row['isDefault'] as int) != 0,\n (row['isMainnet'] as int) != 0,\n row['chainID'] as int),\n arguments: [isChoose ? 1 : 0]);\n }\n\n @override\n Future> queryNodeByChainType(int chainType) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM nodes_table WHERE chainType = ?1',\n mapper: (Map row) => NodeModel(\n row['content'] as String,\n row['chainType'] as int,\n (row['isChoose'] as int) != 0,\n (row['isDefault'] as int) != 0,\n (row['isMainnet'] as int) != 0,\n row['chainID'] as int),\n arguments: [chainType]);\n }\n\n @override\n Future> queryNodeByContent(String content) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM nodes_table WHERE content = ?1',\n mapper: (Map row) => NodeModel(\n row['content'] as String,\n row['chainType'] as int,\n (row['isChoose'] as int) != 0,\n (row['isDefault'] as int) != 0,\n (row['isMainnet'] as int) != 0,\n row['chainID'] as int),\n arguments: [content]);\n }\n\n @override\n Future> queryNodeByIsDefaultAndChainType(\n bool isDefault, int chainType) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM nodes_table WHERE isDefault = ?1 And chainType = ?2',\n mapper: (Map row) => NodeModel(\n row['content'] as String,\n row['chainType'] as int,\n (row['isChoose'] as int) != 0,\n (row['isDefault'] as int) != 0,\n (row['isMainnet'] as int) != 0,\n row['chainID'] as int),\n arguments: [isDefault ? 1 : 0, chainType]);\n }\n\n @override\n Future> queryNodeByContentAndChainType(\n String content, int chainType) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM nodes_table WHERE content = ?1 And chainType = ?2',\n mapper: (Map row) => NodeModel(\n row['content'] as String,\n row['chainType'] as int,\n (row['isChoose'] as int) != 0,\n (row['isDefault'] as int) != 0,\n (row['isMainnet'] as int) != 0,\n row['chainID'] as int),\n arguments: [content, chainType]);\n }\n\n @override\n Future insertNodeDatas(List list) async {\n await _nodeModelInsertionAdapter.insertList(list, OnConflictStrategy.abort);\n }\n\n @override\n Future insertNodeData(NodeModel model) async {\n await _nodeModelInsertionAdapter.insert(model, OnConflictStrategy.abort);\n }\n\n @override\n Future updateNode(NodeModel model) async {\n await _nodeModelUpdateAdapter.update(model, OnConflictStrategy.abort);\n }\n\n @override\n Future updateNodes(List models) async {\n await _nodeModelUpdateAdapter.updateList(models, OnConflictStrategy.abort);\n }\n}\n\nclass _$MCollectionTokenDao extends MCollectionTokenDao {\n _$MCollectionTokenDao(this.database, this.changeListener)\n : _queryAdapter = QueryAdapter(database),\n _mCollectionTokensInsertionAdapter = InsertionAdapter(\n database,\n 'tokens_table',\n (MCollectionTokens item) => {\n 'owner': item.owner,\n 'contract': item.contract,\n 'token': item.token,\n 'coinType': item.coinType,\n 'state': item.state,\n 'decimals': item.decimals,\n 'price': item.price,\n 'balance': item.balance,\n 'digits': item.digits\n }),\n _mCollectionTokensUpdateAdapter = UpdateAdapter(\n database,\n 'tokens_table',\n ['owner', 'token'],\n (MCollectionTokens item) => {\n 'owner': item.owner,\n 'contract': item.contract,\n 'token': item.token,\n 'coinType': item.coinType,\n 'state': item.state,\n 'decimals': item.decimals,\n 'price': item.price,\n 'balance': item.balance,\n 'digits': item.digits\n }),\n _mCollectionTokensDeletionAdapter = DeletionAdapter(\n database,\n 'tokens_table',\n ['owner', 'token'],\n (MCollectionTokens item) => {\n 'owner': item.owner,\n 'contract': item.contract,\n 'token': item.token,\n 'coinType': item.coinType,\n 'state': item.state,\n 'decimals': item.decimals,\n 'price': item.price,\n 'balance': item.balance,\n 'digits': item.digits\n });\n\n final sqflite.DatabaseExecutor database;\n\n final StreamController changeListener;\n\n final QueryAdapter _queryAdapter;\n\n final InsertionAdapter _mCollectionTokensInsertionAdapter;\n\n final UpdateAdapter _mCollectionTokensUpdateAdapter;\n\n final DeletionAdapter _mCollectionTokensDeletionAdapter;\n\n @override\n Future> findTokens(String owner) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM tokens_table WHERE owner = ?1',\n mapper: (Map row) => MCollectionTokens(\n owner: row['owner'] as String?,\n contract: row['contract'] as String?,\n token: row['token'] as String?,\n coinType: row['coinType'] as String?,\n state: row['state'] as int?,\n decimals: row['decimals'] as int?,\n price: row['price'] as double?,\n balance: row['balance'] as double?,\n digits: row['digits'] as int?),\n arguments: [owner]);\n }\n\n @override\n Future> findStateTokens(\n String owner, int state) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM tokens_table WHERE owner = ?1 and state = ?2',\n mapper: (Map row) => MCollectionTokens(\n owner: row['owner'] as String?,\n contract: row['contract'] as String?,\n token: row['token'] as String?,\n coinType: row['coinType'] as String?,\n state: row['state'] as int?,\n decimals: row['decimals'] as int?,\n price: row['price'] as double?,\n balance: row['balance'] as double?,\n digits: row['digits'] as int?),\n arguments: [owner, state]);\n }\n\n @override\n Future insertToken(MCollectionTokens model) async {\n await _mCollectionTokensInsertionAdapter.insert(\n model, OnConflictStrategy.replace);\n }\n\n @override\n Future insertTokens(List models) async {\n await _mCollectionTokensInsertionAdapter.insertList(\n models, OnConflictStrategy.replace);\n }\n\n @override\n Future updateTokens(MCollectionTokens model) async {\n await _mCollectionTokensUpdateAdapter.update(\n model, OnConflictStrategy.abort);\n }\n\n @override\n Future deleteTokens(MCollectionTokens model) async {\n await _mCollectionTokensDeletionAdapter.delete(model);\n }\n}\n\nclass _$TransRecordModelDao extends TransRecordModelDao {\n _$TransRecordModelDao(this.database, this.changeListener)\n : _queryAdapter = QueryAdapter(database),\n _transRecordModelInsertionAdapter = InsertionAdapter(\n database,\n 'translist_table',\n (TransRecordModel item) => {\n 'txid': item.txid,\n 'toAdd': item.toAdd,\n 'fromAdd': item.fromAdd,\n 'date': item.date,\n 'amount': item.amount,\n 'remarks': item.remarks,\n 'fee': item.fee,\n 'gasPrice': item.gasPrice,\n 'gasLimit': item.gasLimit,\n 'transStatus': item.transStatus,\n 'symbol': item.symbol,\n 'coinType': item.coinType,\n 'transType': item.transType,\n 'chainid': item.chainid\n }),\n _transRecordModelUpdateAdapter = UpdateAdapter(\n database,\n 'translist_table',\n ['txid'],\n (TransRecordModel item) => {\n 'txid': item.txid,\n 'toAdd': item.toAdd,\n 'fromAdd': item.fromAdd,\n 'date': item.date,\n 'amount': item.amount,\n 'remarks': item.remarks,\n 'fee': item.fee,\n 'gasPrice': item.gasPrice,\n 'gasLimit': item.gasLimit,\n 'transStatus': item.transStatus,\n 'symbol': item.symbol,\n 'coinType': item.coinType,\n 'transType': item.transType,\n 'chainid': item.chainid\n }),\n _transRecordModelDeletionAdapter = DeletionAdapter(\n database,\n 'translist_table',\n ['txid'],\n (TransRecordModel item) => {\n 'txid': item.txid,\n 'toAdd': item.toAdd,\n 'fromAdd': item.fromAdd,\n 'date': item.date,\n 'amount': item.amount,\n 'remarks': item.remarks,\n 'fee': item.fee,\n 'gasPrice': item.gasPrice,\n 'gasLimit': item.gasLimit,\n 'transStatus': item.transStatus,\n 'symbol': item.symbol,\n 'coinType': item.coinType,\n 'transType': item.transType,\n 'chainid': item.chainid\n });\n\n final sqflite.DatabaseExecutor database;\n\n final StreamController changeListener;\n\n final QueryAdapter _queryAdapter;\n\n final InsertionAdapter _transRecordModelInsertionAdapter;\n\n final UpdateAdapter _transRecordModelUpdateAdapter;\n\n final DeletionAdapter _transRecordModelDeletionAdapter;\n\n @override\n Future> queryTrxList(\n String fromAdd, String symbol, int chainid) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM translist_table WHERE (fromAdd = ?1 or toAdd = ?1) and symbol = ?2 and chainid = ?3',\n mapper: (Map row) => TransRecordModel(txid: row['txid'] as String?, toAdd: row['toAdd'] as String?, fromAdd: row['fromAdd'] as String?, date: row['date'] as String?, amount: row['amount'] as String?, remarks: row['remarks'] as String?, fee: row['fee'] as String?, transStatus: row['transStatus'] as int?, symbol: row['symbol'] as String?, coinType: row['coinType'] as String?, gasLimit: row['gasLimit'] as String?, gasPrice: row['gasPrice'] as String?, transType: row['transType'] as int?, chainid: row['chainid'] as int?),\n arguments: [fromAdd, symbol, chainid]);\n }\n\n @override\n Future> queryTrxFromTrxid(String txid) async {\n return _queryAdapter.queryList(\n 'SELECT * FROM translist_table WHERE txid = ?1',\n mapper: (Map row) => TransRecordModel(\n txid: row['txid'] as String?,\n toAdd: row['toAdd'] as String?,\n fromAdd: row['fromAdd'] as String?,\n date: row['date'] as String?,\n amount: row['amount'] as String?,\n remarks: row['remarks'] as String?,\n fee: row['fee'] as String?,\n transStatus: row['transStatus'] as int?,\n symbol: row['symbol'] as String?,\n coinType: row['coinType'] as String?,\n gasLimit: row['gasLimit'] as String?,\n gasPrice: row['gasPrice'] as String?,\n transType: row['transType'] as int?,\n chainid: row['chainid'] as int?),\n arguments: [txid]);\n }\n\n @override\n Future insertTrxList(TransRecordModel model) async {\n await _transRecordModelInsertionAdapter.insert(\n model, OnConflictStrategy.replace);\n }\n\n @override\n Future insertTrxLists(List models) async {\n await _transRecordModelInsertionAdapter.insertList(\n models, OnConflictStrategy.replace);\n }\n\n @override\n Future updateTrxList(TransRecordModel model) async {\n await _transRecordModelUpdateAdapter.update(\n model, OnConflictStrategy.abort);\n }\n\n @override\n Future updateTrxLists(List models) async {\n await _transRecordModelUpdateAdapter.updateList(\n models, OnConflictStrategy.abort);\n }\n\n @override\n Future deleteTrxList(TransRecordModel model) async {\n await _transRecordModelDeletionAdapter.delete(model);\n }\n}\n","avg_line_length":38.160815402,"max_line_length":548,"alphanum_fraction":0.5865384615} {"size":800,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'package:flutter\/material.dart';\nimport 'package:flutter\/widgets.dart';\n\nclass UpDownItem extends StatelessWidget {\n final Widget upWidget;\n final Widget downWidget;\n final callback;\n\n UpDownItem(this.upWidget, this.downWidget, this.callback);\n\n @override\n Widget build(BuildContext context) {\n return InkWell(\n onTap: () => callback(),\n child: Container(\n padding: const EdgeInsets.all(10.0),\n child: Column(\n mainAxisAlignment: MainAxisAlignment.start,\n crossAxisAlignment: CrossAxisAlignment.center,\n children: [\n upWidget,\n Container(\n margin: EdgeInsets.only(top: 5),\n child: downWidget,\n )\n ],\n ),\n ));\n }\n}\n","avg_line_length":25.8064516129,"max_line_length":60,"alphanum_fraction":0.58625} {"size":2952,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/*\n * Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file\n * for details. All rights reserved. Use of this source code is governed by a\n * BSD-style license that can be found in the LICENSE file.\n *\/\n\/**\n * @assertion A type T0 is a subtype of a type T1 (written T0 <: T1) when:\n * Positional Function Types: T0 is U0 Function(V0 x0, ..., Vn xn, [Vn+1 xn+1, ..., Vm xm])\n *\n * and T1 is U1 Function(S0 y0, ...,\n * Sp yp, [Sp+1 yp+1, ..., Sq yq])\n * and p >= n\n * and m >= q\n * and Si[Z0\/Y0, ..., Zk\/Yk] <: Vi[Z0\/X0, ..., Zk\/Xk] for i in 0...q\n * and U0[Z0\/X0, ..., Zk\/Xk] <: U1[Z0\/Y0, ..., Zk\/Yk]\n * and B0i[Z0\/X0, ..., Zk\/Xk] === B1i[Z0\/Y0, ..., Zk\/Yk] for i in 0...k\n * where the Zi are fresh type variables with bounds B0i[Z0\/X0, ..., Zk\/Xk]\n * @description Check that if T0 and T1 satisfies the rules above, then T0 is\n * subtype of T1. Test the case when p > n and m == q.\n * @author sgrekhov@unipro.ru\n *\/\n\/**\n * @description Check that if type T0 is a subtype of a type T1, then instance\n * of T0 can be be assigned to the mixin member of type T1\n * @author sgrekhov@unipro.ru\n *\/\n\/*\n * This test is generated from positional_function_types_A04.dart and \n * class_member_x03.dart.\n * Don't modify it. If you want to change this file, change one of the files \n * above and then run generator.dart to regenerate the tests.\n *\/\n\n\nimport '..\/..\/utils\/common.dart';\n\/\/ SharedOptions=--enable-experiment=non-nullable\nclass U0 extends U1 {}\nclass U1 {}\nclass V0 {}\nclass V1 {}\nclass V2 {}\nclass V3 {}\nclass V4 {}\nclass S0 extends V0 {}\nclass S1 extends V1 {}\nclass S2 extends V2 {}\nclass S3 extends V3 {}\nclass S4 extends V4 {}\n\ntypedef T0 = U0 Function(V0 x0, V1 x1, [V2? x2, V3? x3]);\ntypedef T1 = U1 Function(S0 y0, S1 y1, S2 y2, [S3? y3]);\n\nU0 t0Func(V0 x0, V1 x1, [V2? x2, V3? x3]) => new U0();\nU1 t1Func(S0 y0, S1 y1, S2 y2, [S3? y3]) => new U1();\n\nT0 t0Instance = t0Func;\nT1 t1Instance = t1Func;\n\nconst t1Default = t1Func;\n\n\n\n\nclass ClassMemberMixin1_t03 {\n T1 m = t1Default;\n\n void set superSetter(dynamic val) {}\n}\n\nclass ClassMember1_t03 extends Object with ClassMemberMixin1_t03 {\n test() {\n m = forgetType(t0Instance);\n superSetter = forgetType(t0Instance);\n }\n}\n\nclass ClassMemberMixin2_t03 {\n void set superSetter(dynamic val) {}\n}\n\nclass ClassMember2_t03 extends Object with ClassMemberMixin2_t03 {\n X m;\n ClassMember2_t03(X x): m = x { }\n test() {\n m = forgetType(t0Instance);\n superSetter = forgetType(t0Instance);\n }\n}\n\nmain() {\n ClassMember1_t03 c1 = new ClassMember1_t03();\n c1.m = forgetType(t0Instance);\n c1.test();\n c1.superSetter = forgetType(t0Instance);\n\n \/\/ Test type parameters\n\n \/\/# <-- NotGenericFunctionType\n ClassMember2_t03 c2 = new ClassMember2_t03(t1Instance);\n c2.m = forgetType(t0Instance);\n c2.test();\n c2.superSetter = forgetType(t0Instance);\n \/\/# -->\n}\n","avg_line_length":27.8490566038,"max_line_length":78,"alphanum_fraction":0.6551490515} {"size":3810,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nimport 'package:analyzer\/dart\/element\/element.dart';\nimport 'package:dartdoc\/src\/element_type.dart';\nimport 'package:dartdoc\/src\/model\/comment_referable.dart';\nimport 'package:dartdoc\/src\/model\/extension_target.dart';\nimport 'package:dartdoc\/src\/model\/model.dart';\nimport 'package:meta\/meta.dart';\n\n\/\/\/ Extension methods\nclass Extension extends Container implements EnclosedElement {\n late final ElementType extendedType =\n modelBuilder.typeFrom(element.extendedType, library);\n\n Extension(\n ExtensionElement element, Library library, PackageGraph packageGraph)\n : super(element, library, packageGraph);\n\n \/\/\/ Detect if this extension applies to every object.\n bool get alwaysApplies =>\n extendedType.instantiatedType.isDynamic ||\n extendedType.instantiatedType.isVoid ||\n extendedType.instantiatedType.isDartCoreObject;\n\n bool couldApplyTo(T c) =>\n _couldApplyTo(c.modelType as DefinedElementType);\n\n \/\/\/ Return true if this extension could apply to [t].\n bool _couldApplyTo(DefinedElementType t) {\n if (extendedType.instantiatedType.isDynamic ||\n extendedType.instantiatedType.isVoid) {\n return true;\n }\n return t.instantiatedType == extendedType.instantiatedType ||\n (t.instantiatedType.element == extendedType.instantiatedType.element &&\n extendedType.isSubtypeOf(t)) ||\n extendedType.isBoundSupertypeTo(t);\n }\n\n \/\/\/ Returns the library that encloses this element.\n @override\n ModelElement? get enclosingElement => library;\n\n @override\n String get kind => 'extension';\n\n List? _methods;\n\n @override\n List? get declaredMethods {\n _methods ??= element.methods.map((e) {\n return modelBuilder.from(e, library) as Method;\n }).toList(growable: false);\n return _methods;\n }\n\n @override\n ExtensionElement get element => super.element as ExtensionElement;\n\n @override\n String get name => element.name == null ? '' : super.name;\n\n List? _declaredFields;\n\n @override\n List? get declaredFields {\n _declaredFields ??= element.fields.map((f) {\n Accessor? getter, setter;\n if (f.getter != null) {\n getter = ContainerAccessor(f.getter, library, packageGraph);\n }\n if (f.setter != null) {\n setter = ContainerAccessor(f.setter, library, packageGraph);\n }\n return modelBuilder.fromPropertyInducingElement(f, library,\n getter: getter, setter: setter) as Field;\n }).toList(growable: false);\n return _declaredFields;\n }\n\n List? _typeParameters;\n\n \/\/ a stronger hash?\n @override\n List get typeParameters {\n _typeParameters ??= element.typeParameters.map((f) {\n var lib = modelBuilder.fromElement(f.enclosingElement!.library!);\n return modelBuilder.from(f, lib as Library) as TypeParameter;\n }).toList();\n return _typeParameters!;\n }\n\n @override\n late final List allModelElements = [\n ...super.allModelElements,\n ...typeParameters,\n ];\n\n @override\n String get filePath => '${library.dirName}\/$fileName';\n\n Map? _referenceChildren;\n @override\n Map get referenceChildren {\n return _referenceChildren ??= {\n ...extendedType.referenceChildren,\n \/\/ Override extendedType entries with local items.\n ...super.referenceChildren,\n };\n }\n\n @override\n @visibleForOverriding\n Iterable> get extraReferenceChildren => [];\n\n @override\n String get relationshipsClass => 'clazz-relationships';\n}\n","avg_line_length":31.4876033058,"max_line_length":80,"alphanum_fraction":0.7120734908} {"size":3905,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ ignore_for_file: prefer_const_constructors, use_key_in_widget_constructors\n\nimport 'package:app\/Providers\/auth.dart';\nimport 'package:app\/components\/inputfield.dart';\nimport 'package:app\/constants.dart';\nimport 'package:app\/screens\/mainscreen.dart';\nimport 'package:app\/screens\/registerscreen.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:app\/components\/roundedbutton.dart';\nimport 'dashboard.dart';\n\nclass LoginScreen extends StatefulWidget {\n static const String id = 'login_screen';\n @override\n _LoginScreenState createState() => _LoginScreenState();\n}\n\nclass _LoginScreenState extends State {\n String email = '';\n String password = '';\n bool status = true;\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n backgroundColor: kbgcolor,\n body: SingleChildScrollView(\n child: Container(\n padding: const EdgeInsets.only(\n top: 50,\n left: 20,\n right: 20,\n bottom: 10,\n ),\n child: Column(\n crossAxisAlignment: CrossAxisAlignment.start,\n children: [\n Padding(\n padding: const EdgeInsets.only(\n top: 20,\n ),\n child: IconButton(\n icon: Icon(\n Icons.keyboard_arrow_left,\n color: Colors.white,\n size: 40,\n ),\n onPressed: () {\n Navigator.pushNamed(context, MainScreen.id);\n },\n ),\n ),\n Column(\n mainAxisSize: MainAxisSize.min,\n children: [\n Flexible(\n child: Image.asset(\n 'images\/logo.png',\n alignment: Alignment.center,\n scale: 1.2,\n ),\n ),\n SizedBox(\n height: 50,\n ),\n InputField(\n obscure: false,\n hinttext: 'Email',\n onChanged: (value) {\n email = value;\n }),\n SizedBox(\n height: 20,\n ),\n InputField(\n obscure: true,\n hinttext: 'Password',\n onChanged: (value) {\n password = value;\n }),\n SizedBox(\n height: 20,\n ),\n RoundedButton(\n onPressed: () async {\n String token = await loginUser(email, password);\n if (token == 'Error') {\n setState(() {\n status = false;\n });\n } else {\n Navigator.pushNamed(\n context,\n DashBoard.id,\n );\n }\n },\n title: \"Login\",\n ),\n GestureDetector(\n child: Text(\n 'New here? Register Now!',\n textAlign: TextAlign.center,\n style: TextStyle(\n color: Colors.white,\n fontSize: 16,\n ),\n ),\n onTap: () {\n Navigator.pushNamed(context, RegisterScreen.id);\n },\n ),\n Text(status == false ? 'Unable To Login' : '',\n style: TextStyle(color: Colors.white)),\n ],\n ),\n ],\n ),\n ),\n ),\n );\n }\n}\n","avg_line_length":31.7479674797,"max_line_length":77,"alphanum_fraction":0.4002560819} {"size":16638,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"\/\/ Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nimport \"package:kernel\/ast.dart\"\n show\n Arguments,\n Class,\n DartType,\n Expression,\n Field,\n FunctionNode,\n Member,\n Name,\n NamedExpression,\n Procedure,\n ProcedureKind,\n ReturnStatement,\n SuperMethodInvocation,\n SuperPropertyGet,\n SuperPropertySet,\n TypeParameter,\n TypeParameterType,\n VariableDeclaration,\n VariableGet,\n Variance,\n VoidType;\n\nimport 'package:kernel\/transformations\/flags.dart' show TransformerFlag;\n\nimport \"package:kernel\/type_algebra.dart\" show Substitution;\n\nimport \"..\/builder\/class_builder.dart\";\n\nimport \"..\/problems.dart\" show unhandled;\n\nimport \"..\/type_inference\/type_inference_engine.dart\"\n show IncludesTypeParametersNonCovariantly;\n\nimport \"..\/type_inference\/type_inferrer.dart\" show getNamedFormal;\n\nimport 'class_hierarchy_builder.dart';\n\nclass ForwardingNode {\n final ClassHierarchyBuilder hierarchy;\n\n final ClassBuilder parent;\n\n final ClassMember combinedMemberSignatureResult;\n\n final ProcedureKind kind;\n\n \/\/\/ A list containing the directly implemented and directly inherited\n \/\/\/ procedures of the class in question.\n final List _candidates;\n\n ForwardingNode(this.hierarchy, this.parent,\n this.combinedMemberSignatureResult, this._candidates, this.kind);\n\n Name get name => combinedMemberSignatureResult.member.name;\n\n Class get enclosingClass => parent.cls;\n\n \/\/\/ Finishes handling of this node by propagating covariance and creating\n \/\/\/ forwarding stubs if necessary.\n Member finalize() => _computeCovarianceFixes();\n\n \/\/\/ Tag the parameters of [interfaceMember] that need type checks\n \/\/\/\n \/\/\/ Parameters can need type checks for calls coming from statically typed\n \/\/\/ call sites, due to covariant generics and overrides with explicit\n \/\/\/ `covariant` parameters.\n \/\/\/\n \/\/\/ Tag parameters of [interfaceMember] that need such checks when the member\n \/\/\/ occurs in [enclosingClass]'s interface. If parameters need checks but\n \/\/\/ they would not be checked in an inherited implementation, a forwarding\n \/\/\/ stub is introduced as a place to put the checks.\n Member _computeCovarianceFixes() {\n Member interfaceMember = combinedMemberSignatureResult.member;\n Substitution substitution =\n _substitutionFor(interfaceMember, enclosingClass);\n \/\/ We always create a forwarding stub when we've inherited a member from an\n \/\/ interface other than the first override candidate. This is to work\n \/\/ around a bug in the Kernel type checker where it chooses the first\n \/\/ override candidate.\n \/\/\n \/\/ TODO(kmillikin): Fix the Kernel type checker and stop creating these\n \/\/ extra stubs.\n Member stub = interfaceMember.enclosingClass == enclosingClass ||\n interfaceMember == getCandidateAt(0)\n ? interfaceMember\n : _createForwardingStub(substitution, interfaceMember);\n\n FunctionNode interfaceFunction = interfaceMember.function;\n List interfacePositionalParameters =\n getPositionalParameters(interfaceMember);\n List interfaceNamedParameters =\n interfaceFunction?.namedParameters ?? [];\n List interfaceTypeParameters =\n interfaceFunction?.typeParameters ?? [];\n\n void createStubIfNeeded() {\n if (stub != interfaceMember) return;\n if (interfaceMember.enclosingClass == enclosingClass) return;\n stub = _createForwardingStub(substitution, interfaceMember);\n }\n\n bool isImplCreated = false;\n void createImplIfNeeded() {\n if (isImplCreated) return;\n createStubIfNeeded();\n _createForwardingImplIfNeeded(stub.function);\n isImplCreated = true;\n }\n\n IncludesTypeParametersNonCovariantly needsCheckVisitor =\n enclosingClass.typeParameters.isEmpty\n ? null\n \/\/ TODO(ahe): It may be necessary to cache this object.\n : new IncludesTypeParametersNonCovariantly(\n enclosingClass.typeParameters,\n \/\/ We are checking the parameter types and these are in a\n \/\/ contravariant position.\n initialVariance: Variance.contravariant);\n bool needsCheck(DartType type) => needsCheckVisitor == null\n ? false\n : substitution.substituteType(type).accept(needsCheckVisitor);\n for (int i = 0; i < interfacePositionalParameters.length; i++) {\n VariableDeclaration parameter = interfacePositionalParameters[i];\n bool isGenericCovariantImpl =\n parameter.isGenericCovariantImpl || needsCheck(parameter.type);\n bool isCovariant = parameter.isCovariant;\n VariableDeclaration superParameter = parameter;\n for (int j = 0; j < _candidates.length; j++) {\n Member otherMember = getCandidateAt(j);\n if (otherMember is ForwardingNode) continue;\n List otherPositionalParameters =\n getPositionalParameters(otherMember);\n if (otherPositionalParameters.length <= i) continue;\n VariableDeclaration otherParameter = otherPositionalParameters[i];\n if (j == 0) superParameter = otherParameter;\n if (identical(otherMember, interfaceMember)) continue;\n if (otherParameter.isGenericCovariantImpl) {\n isGenericCovariantImpl = true;\n }\n if (otherParameter.isCovariant) {\n isCovariant = true;\n }\n }\n if (isGenericCovariantImpl) {\n if (!superParameter.isGenericCovariantImpl) {\n createImplIfNeeded();\n }\n if (!parameter.isGenericCovariantImpl) {\n createStubIfNeeded();\n stub.function.positionalParameters[i].isGenericCovariantImpl = true;\n }\n }\n if (isCovariant) {\n if (!superParameter.isCovariant) {\n createImplIfNeeded();\n }\n if (!parameter.isCovariant) {\n createStubIfNeeded();\n stub.function.positionalParameters[i].isCovariant = true;\n }\n }\n }\n for (int i = 0; i < interfaceNamedParameters.length; i++) {\n VariableDeclaration parameter = interfaceNamedParameters[i];\n bool isGenericCovariantImpl =\n parameter.isGenericCovariantImpl || needsCheck(parameter.type);\n bool isCovariant = parameter.isCovariant;\n VariableDeclaration superParameter = parameter;\n for (int j = 0; j < _candidates.length; j++) {\n Member otherMember = getCandidateAt(j);\n if (otherMember is ForwardingNode) continue;\n VariableDeclaration otherParameter =\n getNamedFormal(otherMember.function, parameter.name);\n if (otherParameter == null) continue;\n if (j == 0) superParameter = otherParameter;\n if (identical(otherMember, interfaceMember)) continue;\n if (otherParameter.isGenericCovariantImpl) {\n isGenericCovariantImpl = true;\n }\n if (otherParameter.isCovariant) {\n isCovariant = true;\n }\n }\n if (isGenericCovariantImpl) {\n if (!superParameter.isGenericCovariantImpl) {\n createImplIfNeeded();\n }\n if (!parameter.isGenericCovariantImpl) {\n createStubIfNeeded();\n stub.function.namedParameters[i].isGenericCovariantImpl = true;\n }\n }\n if (isCovariant) {\n if (!superParameter.isCovariant) {\n createImplIfNeeded();\n }\n if (!parameter.isCovariant) {\n createStubIfNeeded();\n stub.function.namedParameters[i].isCovariant = true;\n }\n }\n }\n for (int i = 0; i < interfaceTypeParameters.length; i++) {\n TypeParameter typeParameter = interfaceTypeParameters[i];\n bool isGenericCovariantImpl = typeParameter.isGenericCovariantImpl ||\n needsCheck(typeParameter.bound);\n TypeParameter superTypeParameter = typeParameter;\n for (int j = 0; j < _candidates.length; j++) {\n Member otherMember = getCandidateAt(j);\n if (otherMember is ForwardingNode) continue;\n List otherTypeParameters =\n otherMember.function.typeParameters;\n if (otherTypeParameters.length <= i) continue;\n TypeParameter otherTypeParameter = otherTypeParameters[i];\n if (j == 0) superTypeParameter = otherTypeParameter;\n if (identical(otherMember, interfaceMember)) continue;\n if (otherTypeParameter.isGenericCovariantImpl) {\n isGenericCovariantImpl = true;\n }\n }\n if (isGenericCovariantImpl) {\n if (!superTypeParameter.isGenericCovariantImpl) {\n createImplIfNeeded();\n }\n if (!typeParameter.isGenericCovariantImpl) {\n createStubIfNeeded();\n stub.function.typeParameters[i].isGenericCovariantImpl = true;\n }\n }\n }\n return stub;\n }\n\n void _createForwardingImplIfNeeded(FunctionNode function) {\n if (function.body != null) {\n \/\/ There is already an implementation; nothing further needs to be done.\n return;\n }\n \/\/ Find the concrete implementation in the superclass; this is what we need\n \/\/ to forward to. If we can't find one, then the method is fully abstract\n \/\/ and we don't need to do anything.\n Class superclass = enclosingClass.superclass;\n if (superclass == null) return;\n Procedure procedure = function.parent;\n Member superTarget = hierarchy.getDispatchTargetKernel(\n superclass, procedure.name, kind == ProcedureKind.Setter);\n if (superTarget == null) return;\n if (superTarget is Procedure && superTarget.isForwardingStub) {\n superTarget = _getForwardingStubSuperTarget(superTarget);\n }\n procedure.isAbstract = false;\n if (!procedure.isForwardingStub) {\n \/\/ This procedure exists abstractly in the source code; we need to make it\n \/\/ concrete and give it a body that is a forwarding stub. This situation\n \/\/ is called a \"forwarding semi-stub\".\n procedure.isForwardingStub = true;\n procedure.isForwardingSemiStub = true;\n }\n List positionalArguments = function.positionalParameters\n .map((parameter) => new VariableGet(parameter))\n .toList();\n List namedArguments = function.namedParameters\n .map((parameter) =>\n new NamedExpression(parameter.name, new VariableGet(parameter)))\n .toList();\n List typeArguments = function.typeParameters\n .map((typeParameter) =>\n new TypeParameterType.withDefaultNullabilityForLibrary(\n typeParameter, enclosingClass.enclosingLibrary))\n .toList();\n Arguments arguments = new Arguments(positionalArguments,\n types: typeArguments, named: namedArguments);\n Expression superCall;\n switch (kind) {\n case ProcedureKind.Method:\n case ProcedureKind.Operator:\n superCall = new SuperMethodInvocation(name, arguments, superTarget);\n break;\n case ProcedureKind.Getter:\n superCall = new SuperPropertyGet(name, superTarget);\n break;\n case ProcedureKind.Setter:\n superCall =\n new SuperPropertySet(name, positionalArguments[0], superTarget);\n break;\n default:\n unhandled('$kind', '_createForwardingImplIfNeeded', -1, null);\n break;\n }\n function.body = new ReturnStatement(superCall)..parent = function;\n procedure.transformerFlags |= TransformerFlag.superCalls;\n procedure.forwardingStubSuperTarget = superTarget;\n }\n\n \/\/\/ Creates a forwarding stub based on the given [target].\n Procedure _createForwardingStub(Substitution substitution, Member target) {\n VariableDeclaration copyParameter(VariableDeclaration parameter) {\n return new VariableDeclaration(parameter.name,\n type: substitution.substituteType(parameter.type),\n isCovariant: parameter.isCovariant)\n ..isGenericCovariantImpl = parameter.isGenericCovariantImpl;\n }\n\n List targetTypeParameters =\n target.function?.typeParameters ?? [];\n List typeParameters;\n if (targetTypeParameters.isNotEmpty) {\n typeParameters =\n new List.filled(targetTypeParameters.length, null);\n Map additionalSubstitution =\n {};\n for (int i = 0; i < targetTypeParameters.length; i++) {\n TypeParameter targetTypeParameter = targetTypeParameters[i];\n TypeParameter typeParameter = new TypeParameter(\n targetTypeParameter.name, null)\n ..isGenericCovariantImpl = targetTypeParameter.isGenericCovariantImpl;\n typeParameters[i] = typeParameter;\n additionalSubstitution[targetTypeParameter] =\n new TypeParameterType.forAlphaRenaming(\n targetTypeParameter, typeParameter);\n }\n substitution = Substitution.combine(\n substitution, Substitution.fromMap(additionalSubstitution));\n for (int i = 0; i < typeParameters.length; i++) {\n typeParameters[i].bound =\n substitution.substituteType(targetTypeParameters[i].bound);\n }\n }\n List positionalParameters =\n getPositionalParameters(target).map(copyParameter).toList();\n List namedParameters =\n target.function?.namedParameters?.map(copyParameter)?.toList() ?? [];\n FunctionNode function = new FunctionNode(null,\n positionalParameters: positionalParameters,\n namedParameters: namedParameters,\n typeParameters: typeParameters,\n requiredParameterCount: getRequiredParameterCount(target),\n returnType: substitution.substituteType(getReturnType(target)));\n Member finalTarget;\n if (target is Procedure && target.isForwardingStub) {\n finalTarget = target.forwardingStubInterfaceTarget;\n } else {\n finalTarget = target;\n }\n return new Procedure(name, kind, function,\n isAbstract: true,\n isForwardingStub: true,\n fileUri: enclosingClass.fileUri,\n forwardingStubInterfaceTarget: finalTarget)\n ..startFileOffset = enclosingClass.fileOffset\n ..fileOffset = enclosingClass.fileOffset\n ..parent = enclosingClass;\n }\n\n \/\/\/ Returns the [i]th element of [_candidates], finalizing it if necessary.\n Member getCandidateAt(int i) {\n ClassMember candidate = _candidates[i];\n assert(candidate is! DelayedMember);\n return candidate.member;\n }\n\n static Member _getForwardingStubSuperTarget(Procedure forwardingStub) {\n \/\/ TODO(paulberry): when dartbug.com\/31562 is fixed, this should become\n \/\/ easier.\n ReturnStatement body = forwardingStub.function.body;\n Expression expression = body.expression;\n if (expression is SuperMethodInvocation) {\n return expression.interfaceTarget;\n } else if (expression is SuperPropertySet) {\n return expression.interfaceTarget;\n } else {\n return unhandled('${expression.runtimeType}',\n '_getForwardingStubSuperTarget', -1, null);\n }\n }\n\n Substitution _substitutionFor(Member candidate, Class class_) {\n return Substitution.fromInterfaceType(hierarchy.getKernelTypeAsInstanceOf(\n hierarchy.coreTypes\n .thisInterfaceType(class_, class_.enclosingLibrary.nonNullable),\n candidate.enclosingClass,\n class_.enclosingLibrary));\n }\n\n List getPositionalParameters(Member member) {\n if (member is Field) {\n if (kind == ProcedureKind.Setter) {\n return [\n new VariableDeclaration(\"_\",\n type: member.type, isCovariant: member.isCovariant)\n ..isGenericCovariantImpl = member.isGenericCovariantImpl\n ];\n } else {\n return [];\n }\n } else {\n return member.function.positionalParameters;\n }\n }\n\n int getRequiredParameterCount(Member member) {\n switch (kind) {\n case ProcedureKind.Getter:\n return 0;\n case ProcedureKind.Setter:\n return 1;\n default:\n return member.function.requiredParameterCount;\n }\n }\n\n DartType getReturnType(Member member) {\n switch (kind) {\n case ProcedureKind.Getter:\n return member is Field ? member.type : member.function.returnType;\n case ProcedureKind.Setter:\n return const VoidType();\n default:\n return member.function.returnType;\n }\n }\n}\n","avg_line_length":38.7832167832,"max_line_length":80,"alphanum_fraction":0.684216853} {"size":7172,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nlibrary service_test_common;\n\nimport 'dart:async';\nimport 'package:vm_service\/vm_service.dart';\nimport 'package:test\/test.dart';\n\ntypedef IsolateTest = Future Function(\n VmService service, IsolateRef isolate);\ntypedef VMTest = Future Function(VmService service);\n\nFuture smartNext(VmService service, IsolateRef isolateRef) async {\n print('smartNext');\n final isolate = await service.getIsolate(isolateRef.id);\n if ((isolate.pauseEvent != null) &&\n (isolate.pauseEvent.kind == EventKind.kPauseBreakpoint)) {\n Event event = isolate.pauseEvent;\n \/\/ TODO(bkonyi): remove needless refetching of isolate object.\n if (event?.atAsyncSuspension ?? false) {\n return asyncNext(service, isolateRef);\n } else {\n return syncNext(service, isolateRef);\n }\n } else {\n throw 'The program is already running';\n }\n}\n\nFuture asyncNext(VmService service, IsolateRef isolateRef) async {\n print('asyncNext');\n final isolate = await service.getIsolate(isolateRef.id);\n if ((isolate.pauseEvent != null) &&\n (isolate.pauseEvent.kind == EventKind.kPauseBreakpoint)) {\n dynamic event = isolate.pauseEvent;\n if (!event.atAsyncSuspension) {\n throw 'No async continuation at this location';\n } else {\n return service.resume(isolateRef.id, step: 'OverAsyncSuspension');\n }\n } else {\n throw 'The program is already running';\n }\n}\n\nFuture syncNext(VmService service, IsolateRef isolateRef) async {\n print('syncNext');\n final isolate = await service.getIsolate(isolateRef.id);\n if ((isolate.pauseEvent != null) &&\n (isolate.pauseEvent.kind == EventKind.kPauseBreakpoint)) {\n return service.resume(isolate.id, step: 'Over');\n } else {\n throw 'The program is already running';\n }\n}\n\nFuture hasPausedFor(\n VmService service, IsolateRef isolateRef, String kind) async {\n var completer = Completer();\n var subscription;\n subscription = service.onDebugEvent.listen((event) async {\n if ((isolateRef.id == event.isolate.id) && (event.kind == kind)) {\n if (completer != null) {\n try {\n await service.streamCancel(EventStreams.kDebug);\n } catch (_) {\/* swallow exception *\/} finally {\n subscription.cancel();\n completer?.complete();\n completer = null;\n }\n }\n }\n });\n\n await _subscribeDebugStream(service);\n\n \/\/ Pause may have happened before we subscribed.\n final isolate = await service.getIsolate(isolateRef.id);\n if ((isolate.pauseEvent != null) && (isolate.pauseEvent.kind == kind)) {\n if (completer != null) {\n try {\n await service.streamCancel(EventStreams.kDebug);\n } catch (_) {\/* swallow exception *\/} finally {\n subscription.cancel();\n completer?.complete();\n }\n }\n }\n return completer?.future; \/\/ Will complete when breakpoint hit.\n}\n\nFuture hasStoppedAtBreakpoint(VmService service, IsolateRef isolate) {\n return hasPausedFor(service, isolate, EventKind.kPauseBreakpoint);\n}\n\nFuture hasStoppedPostRequest(VmService service, IsolateRef isolate) {\n return hasPausedFor(service, isolate, EventKind.kPausePostRequest);\n}\n\nFuture hasStoppedWithUnhandledException(\n VmService service, IsolateRef isolate) {\n return hasPausedFor(service, isolate, EventKind.kPauseException);\n}\n\nFuture hasStoppedAtExit(VmService service, IsolateRef isolate) {\n return hasPausedFor(service, isolate, EventKind.kPauseExit);\n}\n\nFuture hasPausedAtStart(VmService service, IsolateRef isolate) {\n return hasPausedFor(service, isolate, EventKind.kPauseStart);\n}\n\n\/\/ Currying is your friend.\nIsolateTest setBreakpointAtLine(int line) {\n return (VmService service, IsolateRef isolateRef) async {\n print(\"Setting breakpoint for line $line\");\n final isolate = await service.getIsolate(isolateRef.id);\n final Library lib = await service.getObject(isolate.id, isolate.rootLib.id);\n final script = lib.scripts.first;\n\n Breakpoint bpt = await service.addBreakpoint(isolate.id, script.id, line);\n print(\"Breakpoint is $bpt\");\n };\n}\n\nIsolateTest stoppedAtLine(int line) {\n return (VmService service, IsolateRef isolateRef) async {\n print(\"Checking we are at line $line\");\n\n \/\/ Make sure that the isolate has stopped.\n final isolate = await service.getIsolate(isolateRef.id);\n expect(isolate.pauseEvent != EventKind.kResume, isTrue);\n\n final stack = await service.getStack(isolateRef.id);\n\n final frames = stack.frames;\n expect(frames.length, greaterThanOrEqualTo(1));\n\n final top = frames[0];\n final Script script =\n await service.getObject(isolate.id, top.location.script.id);\n int actualLine = script.getLineNumberFromTokenPos(top.location.tokenPos);\n if (actualLine != line) {\n print(\"Actual: $actualLine Line: $line\");\n final sb = StringBuffer();\n sb.write(\"Expected to be at line $line but actually at line $actualLine\");\n sb.write(\"\\nFull stack trace:\\n\");\n for (Frame f in stack.frames) {\n sb.write(\n \" $f [${script.getLineNumberFromTokenPos(f.location.tokenPos)}]\\n\");\n }\n throw sb.toString();\n } else {\n print('Program is stopped at line: $line');\n }\n };\n}\n\nFuture resumeIsolate(VmService service, IsolateRef isolate) async {\n Completer completer = Completer();\n var subscription;\n subscription = service.onDebugEvent.listen((event) async {\n if (event.kind == EventKind.kResume) {\n try {\n await service.streamCancel(EventStreams.kDebug);\n } catch (_) {\/* swallow exception *\/} finally {\n subscription.cancel();\n completer.complete();\n }\n }\n });\n await service.streamListen(EventStreams.kDebug);\n await service.resume(isolate.id);\n return completer.future;\n}\n\nFuture _subscribeDebugStream(VmService service) async {\n try {\n await service.streamListen(EventStreams.kDebug);\n } catch (_) {\n \/* swallow exception *\/\n }\n}\n\nFuture _unsubscribeDebugStream(VmService service) async {\n try {\n await service.streamCancel(EventStreams.kDebug);\n } catch (_) {\n \/* swallow exception *\/\n }\n}\n\nFuture stepOver(VmService service, IsolateRef isolateRef) async {\n await service.streamListen(EventStreams.kDebug);\n await _subscribeDebugStream(service);\n await service.resume(isolateRef.id, step: 'Over');\n await hasStoppedAtBreakpoint(service, isolateRef);\n await _unsubscribeDebugStream(service);\n}\n\nFuture stepInto(VmService service, IsolateRef isolateRef) async {\n await _subscribeDebugStream(service);\n await service.resume(isolateRef.id, step: 'Into');\n await hasStoppedAtBreakpoint(service, isolateRef);\n await _unsubscribeDebugStream(service);\n}\n\nFuture stepOut(VmService service, IsolateRef isolateRef) async {\n await _subscribeDebugStream(service);\n await service.resume(isolateRef.id, step: 'Out');\n await hasStoppedAtBreakpoint(service, isolateRef);\n await _unsubscribeDebugStream(service);\n}\n","avg_line_length":33.2037037037,"max_line_length":80,"alphanum_fraction":0.705103179} {"size":8558,"ext":"dart","lang":"Dart","max_stars_count":7.0,"content":"import 'dart:convert';\n\nimport 'package:flutter\/foundation.dart';\nimport 'package:flutter\/material.dart';\nimport 'dart:async';\nimport 'dart:io';\n\nimport 'package:camera\/camera.dart';\nimport 'package:flutter_barcode_sdk\/dynamsoft_barcode.dart';\nimport 'package:flutter_barcode_sdk\/flutter_barcode_sdk.dart';\nimport 'package:camera_platform_interface\/camera_platform_interface.dart';\nimport 'package:flutter_barcode_sdk_example\/utils.dart';\n\nclass Mobile extends StatefulWidget {\n final CameraDescription camera;\n\n const Mobile({\n Key key,\n @required this.camera,\n }) : super(key: key);\n\n @override\n MobileState createState() => MobileState();\n}\n\nclass MobileState extends State {\n CameraController _controller;\n Future _initializeControllerFuture;\n FlutterBarcodeSdk _barcodeReader;\n bool _isScanAvailable = true;\n bool _isScanRunning = false;\n String _barcodeResults = '';\n String _buttonText = 'Start Video Scan';\n\n @override\n void initState() {\n super.initState();\n \/\/ To display the current output from the Camera,\n \/\/ create a CameraController.\n _controller = CameraController(\n \/\/ Get a specific camera from the list of available cameras.\n widget.camera,\n \/\/ Define the resolution to use.\n ResolutionPreset.medium,\n );\n\n \/\/ Next, initialize the controller. This returns a Future.\n _initializeControllerFuture = _controller.initialize();\n _initializeControllerFuture.then((_) {\n setState(() {});\n });\n \/\/ Initialize Dynamsoft Barcode Reader\n initBarcodeSDK();\n }\n\n Future initBarcodeSDK() async {\n _barcodeReader = FlutterBarcodeSdk();\n \/\/ Get 30-day FREEE trial license from https:\/\/www.dynamsoft.com\/customer\/license\/trialLicense?product=dbr\n await _barcodeReader.setLicense(\n 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==');\n await _barcodeReader.init();\n await _barcodeReader.setBarcodeFormats(BarcodeFormat.ALL);\n \/\/ Get all current parameters.\n \/\/ Refer to: https:\/\/www.dynamsoft.com\/barcode-reader\/parameters\/reference\/image-parameter\/?ver=latest\n String params = await _barcodeReader.getParameters();\n \/\/ Convert parameters to a JSON object.\n dynamic obj = json.decode(params);\n \/\/ Modify parameters.\n obj['ImageParameter']['DeblurLevel'] = 5;\n \/\/ Update the parameters.\n int ret = await _barcodeReader.setParameters(json.encode(obj));\n print('Parameter update: $ret');\n }\n\n void pictureScan() async {\n final image = await _controller.takePicture();\n List results = await _barcodeReader.decodeFile(image?.path);\n\n \/\/ Uint8List bytes = await image.readAsBytes();\n \/\/ List results =\n \/\/ await _barcodeReader.decodeFileBytes(bytes);\n\n \/\/ If the picture was taken, display it on a new screen.\n Navigator.push(\n context,\n MaterialPageRoute(\n builder: (context) => DisplayPictureScreen(\n \/\/ Pass the automatically generated path to\n \/\/ the DisplayPictureScreen widget.\n imagePath: image?.path,\n barcodeResults: getBarcodeResults(results)),\n ),\n );\n }\n\n void videoScan() async {\n if (!_isScanRunning) {\n setState(() {\n _buttonText = 'Stop Video Scan';\n });\n _isScanRunning = true;\n await _controller.startImageStream((CameraImage availableImage) async {\n assert(defaultTargetPlatform == TargetPlatform.android ||\n defaultTargetPlatform == TargetPlatform.iOS);\n int format = FlutterBarcodeSdk.IF_UNKNOWN;\n\n switch (availableImage.format.group) {\n case ImageFormatGroup.yuv420:\n format = FlutterBarcodeSdk.IF_YUV420;\n break;\n case ImageFormatGroup.bgra8888:\n format = FlutterBarcodeSdk.IF_BRGA8888;\n break;\n default:\n format = FlutterBarcodeSdk.IF_UNKNOWN;\n }\n\n if (!_isScanAvailable) {\n return;\n }\n\n _isScanAvailable = false;\n\n _barcodeReader\n .decodeImageBuffer(\n availableImage.planes[0].bytes,\n availableImage.width,\n availableImage.height,\n availableImage.planes[0].bytesPerRow,\n format)\n .then((results) {\n if (_isScanRunning) {\n setState(() {\n _barcodeResults = getBarcodeResults(results);\n });\n }\n\n _isScanAvailable = true;\n }).catchError((error) {\n _isScanAvailable = false;\n });\n });\n } else {\n setState(() {\n _buttonText = 'Start Video Scan';\n _barcodeResults = '';\n });\n _isScanRunning = false;\n await _controller.stopImageStream();\n }\n }\n\n @override\n void dispose() {\n \/\/ Dispose of the controller when the widget is disposed.\n _controller?.dispose();\n super.dispose();\n }\n\n Widget getCameraWidget() {\n if (!_controller.value.isInitialized) {\n return Center(child: CircularProgressIndicator());\n } else {\n \/\/ https:\/\/stackoverflow.com\/questions\/49946153\/flutter-camera-appears-stretched\n final size = MediaQuery.of(context).size;\n var scale = size.aspectRatio * _controller.value.aspectRatio;\n\n if (scale < 1) scale = 1 \/ scale;\n\n return Transform.scale(\n scale: scale,\n child: Center(\n child: CameraPreview(_controller),\n ),\n );\n \/\/ return CameraPreview(_controller);\n }\n }\n\n @override\n Widget build(BuildContext context) {\n return Stack(children: [\n getCameraWidget(),\n Column(\n mainAxisAlignment: MainAxisAlignment.end,\n children: [\n Container(\n height: 100,\n child: SingleChildScrollView(\n child: Text(\n _barcodeResults,\n style: TextStyle(fontSize: 14, color: Colors.white),\n ),\n ),\n ),\n Container(\n height: 100,\n child: Row(\n mainAxisAlignment: MainAxisAlignment.spaceEvenly,\n children: [\n MaterialButton(\n child: Text(_buttonText),\n textColor: Colors.white,\n color: Colors.blue,\n onPressed: () async {\n try {\n \/\/ Ensure that the camera is initialized.\n await _initializeControllerFuture;\n\n videoScan();\n \/\/ pictureScan();\n } catch (e) {\n \/\/ If an error occurs, log the error to the console.\n print(e);\n }\n }),\n MaterialButton(\n child: Text(\"Picture Scan\"),\n textColor: Colors.white,\n color: Colors.blue,\n onPressed: () async {\n pictureScan();\n })\n ]),\n ),\n ],\n )\n ]);\n }\n}\n\n\/\/ A widget that displays the picture taken by the user.\nclass DisplayPictureScreen extends StatelessWidget {\n final String imagePath;\n final String barcodeResults;\n\n const DisplayPictureScreen({Key key, this.imagePath, this.barcodeResults})\n : super(key: key);\n\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n appBar: AppBar(title: Text('Dynamsoft Barcode Reader')),\n \/\/ The image is stored as a file on the device. Use the `Image.file`\n \/\/ constructor with the given path to display the image.\n body: Stack(\n alignment: const Alignment(0.0, 0.0),\n children: [\n \/\/ Show full screen image: https:\/\/stackoverflow.com\/questions\/48716067\/show-fullscreen-image-at-flutter\n Image.file(\n File(imagePath),\n fit: BoxFit.cover,\n height: double.infinity,\n width: double.infinity,\n alignment: Alignment.center,\n ),\n Container(\n decoration: BoxDecoration(\n color: Colors.black45,\n ),\n child: Text(\n \/\/ 'Dynamsoft Barcode Reader',\n barcodeResults,\n style: TextStyle(\n fontSize: 14,\n color: Colors.white,\n ),\n ),\n ),\n ],\n ),\n );\n }\n}\n","avg_line_length":31.12,"max_line_length":156,"alphanum_fraction":0.5910259406} {"size":1120,"ext":"dart","lang":"Dart","max_stars_count":29.0,"content":"\/\/ Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\n\/\/\/ @assertion void fillRange(int start, int end, [E fill])\n\/\/\/ Sets the objects in the range start inclusive to end exclusive to the given\n\/\/\/ fillValue.\n\/\/\/ The provide range, given by start and end, must be valid. A range from start\n\/\/\/ to end is valid if 0 <= start <= end <= len, where len is this list's length.\n\/\/\/ The range starts at start and has length end - start. An empty range (with\n\/\/\/ end == start) is valid.\n\/\/\/ @description Checks that an error occurs if the given range is not valid.\n\/\/\/ @author msyabro\n\n\nimport \"dart:typed_data\";\nimport \"..\/..\/..\/Utils\/expect.dart\";\n\nmain() {\n var l = new Float32List(1000);\n Expect.throws(() { l.fillRange(-100, -10, 1.0); });\n Expect.throws(() { l.fillRange(-1, 2, 1.0); });\n Expect.throws(() { l.fillRange(1000, 0, 1.0); });\n Expect.throws(() { l.fillRange(0, 1001, 1.0); });\n Expect.throws(() { l.fillRange(999, 1001, 1.0); });\n}\n","avg_line_length":41.4814814815,"max_line_length":81,"alphanum_fraction":0.6598214286} {"size":2525,"ext":"dart","lang":"Dart","max_stars_count":3176.0,"content":"\/\/ Copyright 2018 Google Inc. Use of this source code is governed by an\n\/\/ MIT-style license that can be found in the LICENSE file or at\n\/\/ https:\/\/opensource.org\/licenses\/MIT.\n\nimport 'dart:js_util';\n\nimport 'package:js\/js.dart';\n\nimport '..\/..\/..\/value.dart';\nimport '..\/..\/utils.dart';\n\n@JS()\nclass _NodeSassColor {\n external SassColor get dartValue;\n external set dartValue(SassColor dartValue);\n}\n\n\/\/\/ Creates a new `sass.types.Color` object wrapping [value].\nObject newNodeSassColor(SassColor value) =>\n callConstructor(colorConstructor, [null, null, null, null, value])\n as Object;\n\n\/\/\/ The JS constructor for the `sass.types.Color` class.\nfinal Function colorConstructor = createClass('SassColor',\n (_NodeSassColor thisArg, num? redOrArgb,\n [num? green, num? blue, num? alpha, SassColor? dartValue]) {\n if (dartValue != null) {\n thisArg.dartValue = dartValue;\n return;\n }\n\n \/\/ This has two signatures:\n \/\/\n \/\/ * `new sass.types.Color(red, green, blue, [alpha])`\n \/\/ * `new sass.types.Color(argb)`\n \/\/\n \/\/ The latter takes an integer that's interpreted as the hex value 0xAARRGGBB.\n num red;\n if (green == null || blue == null) {\n var argb = redOrArgb as int;\n alpha = (argb >> 24) \/ 0xff;\n red = (argb >> 16) % 0x100;\n green = (argb >> 8) % 0x100;\n blue = argb % 0x100;\n } else {\n \/\/ Either [dartValue] or [redOrArgb] must be passed.\n red = redOrArgb!;\n }\n\n thisArg.dartValue = SassColor.rgb(\n _clamp(red), _clamp(green), _clamp(blue), alpha?.clamp(0, 1) ?? 1);\n}, {\n 'getR': (_NodeSassColor thisArg) => thisArg.dartValue.red,\n 'getG': (_NodeSassColor thisArg) => thisArg.dartValue.green,\n 'getB': (_NodeSassColor thisArg) => thisArg.dartValue.blue,\n 'getA': (_NodeSassColor thisArg) => thisArg.dartValue.alpha,\n 'setR': (_NodeSassColor thisArg, num value) {\n thisArg.dartValue = thisArg.dartValue.changeRgb(red: _clamp(value));\n },\n 'setG': (_NodeSassColor thisArg, num value) {\n thisArg.dartValue = thisArg.dartValue.changeRgb(green: _clamp(value));\n },\n 'setB': (_NodeSassColor thisArg, num value) {\n thisArg.dartValue = thisArg.dartValue.changeRgb(blue: _clamp(value));\n },\n 'setA': (_NodeSassColor thisArg, num value) {\n thisArg.dartValue = thisArg.dartValue.changeRgb(alpha: value.clamp(0, 1));\n },\n 'toString': (_NodeSassColor thisArg) => thisArg.dartValue.toString()\n});\n\n\/\/\/ Clamps [channel] within the range 0, 255 and rounds it to the nearest\n\/\/\/ integer.\nint _clamp(num channel) => channel.clamp(0, 255).round();\n","avg_line_length":33.6666666667,"max_line_length":80,"alphanum_fraction":0.6720792079} {"size":8104,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/************* \u00a9 Copyrighted by Thinkcreative_Technologies. An Exclusive item of Envato market. Make sure you have purchased a Regular License OR Extended license for the Source Code from Envato to use this product. See the License Defination attached with source code. *********************\n\nimport 'dart:async';\nimport 'dart:typed_data';\nimport 'package:fiberchat\/Configs\/Enum.dart';\nimport 'package:fiberchat\/Configs\/app_constants.dart';\nimport 'package:fiberchat\/Utils\/utils.dart';\nimport 'package:intl\/date_symbol_data_local.dart';\nimport 'package:intl\/intl.dart' show DateFormat;\nimport 'package:flutter\/material.dart';\nimport 'package:flutter_sound\/flutter_sound.dart';\n\n\/\/\/\ntypedef Fn = void Function();\n\n\/\/\/ Example app.\nclass MultiPlayback extends StatefulWidget {\n final String? url;\n final bool? isMe;\n final Function? onTapDownloadFn;\n MultiPlayback({this.url, this.isMe, this.onTapDownloadFn});\n @override\n _MultiPlaybackState createState() => _MultiPlaybackState();\n}\n\nclass _MultiPlaybackState extends State {\n FlutterSoundPlayer? _mPlayer1 = FlutterSoundPlayer();\n bool _mPlayer1IsInited = false;\n Uint8List? buffer1;\n String _playerTxt1 = '';\n \/\/ ignore: cancel_subscriptions\n StreamSubscription? _playerSubscription1;\n\n \/\/ Future _getAssetData(String path) async {\n \/\/ var asset = await rootBundle.load(path);\n \/\/ return asset.buffer.asUint8List();\n \/\/ }\n\n @override\n void initState() {\n super.initState();\n initializeDateFormatting();\n\n _mPlayer1!.openAudioSession().then((value) {\n setState(() {\n _mPlayer1IsInited = true;\n });\n });\n }\n\n @override\n void dispose() {\n \/\/ Be careful : you must `close` the audio session when you have finished with it.\n cancelPlayerSubscriptions1();\n _mPlayer1!.closeAudioSession();\n _mPlayer1 = null;\n\n super.dispose();\n }\n\n \/\/ ------- Player1 play a remote file -----------------------\n bool showPlayingLoader = false;\n void play1() async {\n try {\n setState(() {\n showPlayingLoader = true;\n });\n await _mPlayer1!.setSubscriptionDuration(Duration(milliseconds: 10));\n _addListener1();\n\n await _mPlayer1!.startPlayer(\n fromURI: widget.url,\n codec: Codec.mp3,\n whenFinished: () {\n setState(() {});\n });\n } catch (e) {\n setState(() {\n showPlayingLoader = false;\n });\n Fiberchat.toast('This message is deleted by sender');\n }\n }\n\n void cancelPlayerSubscriptions1() {\n if (_playerSubscription1 != null) {\n _playerSubscription1!.cancel();\n _playerSubscription1 = null;\n }\n }\n\n Future stopPlayer1() async {\n cancelPlayerSubscriptions1();\n if (_mPlayer1 != null) {\n await _mPlayer1!.stopPlayer();\n }\n setState(() {});\n }\n\n Future pause1() async {\n if (_mPlayer1 != null) {\n await _mPlayer1!.pausePlayer();\n }\n setState(() {});\n }\n\n Future resume1() async {\n if (_mPlayer1 != null) {\n await _mPlayer1!.resumePlayer();\n }\n setState(() {});\n }\n\n \/\/ ------------------------------------------------------------------------------------\n\n void _addListener1() {\n cancelPlayerSubscriptions1();\n _playerSubscription1 = _mPlayer1!.onProgress!.listen((e) {\n var date = DateTime.fromMillisecondsSinceEpoch(e.position.inMilliseconds,\n isUtc: true);\n var txt = DateFormat('mm:ss:SS', 'en_GB').format(date);\n setState(() {\n _playerTxt1 = txt.substring(0, 8);\n showPlayingLoader = false;\n });\n });\n }\n\n Fn? getPlaybackFn1() {\n try {\n print(widget.url);\n if (!_mPlayer1IsInited) {\n return null;\n }\n return _mPlayer1!.isStopped\n ? play1\n : () {\n stopPlayer1().then((value) => setState(() {}));\n };\n } catch (e) {\n setState(() {\n showPlayingLoader = false;\n });\n Fiberchat.toast('This message is deleted by sender');\n }\n }\n\n Fn? getPauseResumeFn1() {\n if (!_mPlayer1IsInited || _mPlayer1!.isStopped) {\n return null;\n }\n return _mPlayer1!.isPaused ? resume1 : pause1;\n }\n\n @override\n Widget build(BuildContext context) {\n Widget makeBody() {\n return Align(\n alignment: Alignment.center,\n child: Container(\n margin: const EdgeInsets.all(3),\n padding: const EdgeInsets.fromLTRB(7, 2, 14, 7),\n height: 60,\n width: double.infinity,\n alignment: Alignment.center,\n decoration: BoxDecoration(\n borderRadius: BorderRadius.circular(9),\n color: !widget.isMe!\n ? Colors.grey.withOpacity(0.05)\n : Colors.white.withOpacity(0.55),\n border: Border.all(\n color: Colors.blueGrey.withOpacity(0.3),\n width: 0.5,\n ),\n ),\n child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [\n showPlayingLoader == true\n ? Padding(\n padding: const EdgeInsets.only(top: 7, left: 12, right: 7),\n child: SizedBox(\n height: 29,\n width: 29,\n child: Align(\n alignment: Alignment.center,\n child: CircularProgressIndicator(\n strokeWidth: 1.7,\n valueColor:\n AlwaysStoppedAnimation(Colors.grey),\n ),\n ),\n ),\n )\n : IconButton(\n onPressed: getPlaybackFn1(),\n icon: Icon(\n _mPlayer1!.isStopped\n ? Icons.play_circle_outline_outlined\n : Icons.stop_circle_outlined,\n size: 40,\n color: Colors.blueGrey,\n ),\n ),\n SizedBox(\n width: 2,\n ),\n IconButton(\n onPressed: getPauseResumeFn1(),\n icon: Icon(\n _mPlayer1!.isPaused\n ? Icons.play_circle_filled_sharp\n : Icons.pause_circle_filled,\n size: 40,\n color: getPauseResumeFn1() == null\n ? widget.isMe!\n ? DESIGN_TYPE == Themetype.whatsapp\n ? Colors.grey[100]\n : Colors.blueGrey[100]\n : Colors.blueGrey[100]\n : Colors.blueGrey[800],\n ),\n ),\n SizedBox(\n width: 11,\n ),\n _playerTxt1 == '' || _mPlayer1!.isStopped\n ? Padding(\n padding: const EdgeInsets.only(top: 5),\n child: Stack(\n children: [\n IconButton(\n onPressed: () {\n widget.onTapDownloadFn!();\n },\n icon: Icon(\n Icons.mic_rounded,\n color: Colors.grey[400],\n size: 30,\n ),\n ),\n Positioned(\n bottom: 6,\n right: 0,\n child: Icon(\n Icons.download,\n size: 16,\n color: Colors.grey[200],\n ))\n ],\n ),\n )\n : Text(\n _playerTxt1,\n style: TextStyle(\n height: 1.76,\n fontWeight: FontWeight.w500,\n color: Colors.blueGrey[500],\n ),\n ),\n ]),\n ),\n );\n }\n\n return makeBody();\n }\n}\n","avg_line_length":30.3520599251,"max_line_length":294,"alphanum_fraction":0.4922260612} {"size":3184,"ext":"dart","lang":"Dart","max_stars_count":24.0,"content":"Map _removeNull(Map data) {\n var data2 = {};\n\n data.forEach((s, d) {\n if (d != null) data2[s] = d;\n });\n return data2;\n}\n\n\/\/\/NATS Server Info\nclass Info {\n \/\/\/ sever id\n String? serverId;\n\n \/\/\/ server name\n String? serverName;\n\n \/\/\/ server version\n String? version;\n\n \/\/\/ protocol\n int? proto;\n\n \/\/\/ server go version\n String? go;\n\n \/\/\/ host\n String? host;\n\n \/\/\/ port number\n int? port;\n\n \/\/\/ max payload\n int? maxPayload;\n\n \/\/\/client id assigned by server\n int? clientId;\n\n \/\/todo\n \/\/authen required\n \/\/tls_required\n \/\/tls_verify\n \/\/connect_url\n\n \/\/\/constructure\n Info(\n {this.serverId,\n this.serverName,\n this.version,\n this.proto,\n this.go,\n this.host,\n this.port,\n this.maxPayload,\n this.clientId});\n\n \/\/\/constructure from json\n Info.fromJson(Map json) {\n serverId = json['server_id'];\n serverName = json['server_name'];\n version = json['version'];\n proto = json['proto'];\n go = json['go'];\n host = json['host'];\n port = json['port'];\n maxPayload = json['max_payload'];\n clientId = json['client_id'];\n }\n\n \/\/\/convert to json\n Map toJson() {\n final data = {};\n data['server_id'] = serverId;\n data['server_name'] = serverName;\n data['version'] = version;\n data['proto'] = proto;\n data['go'] = go;\n data['host'] = host;\n data['port'] = port;\n data['max_payload'] = maxPayload;\n data['client_id'] = clientId;\n\n return _removeNull(data);\n }\n}\n\n\/\/\/connection option to send to server\nclass ConnectOption {\n \/\/\/NATS server send +OK or not (default nats server is turn on) this client will auto tuen off as after connect\n bool? verbose;\n\n \/\/\/\n bool? pedantic;\n\n \/\/\/ TLS require or not \/\/not implement yet\n bool? tlsRequired;\n\n \/\/\/ Auehtnticatio Token\n String? auth_token;\n\n \/\/\/ username\n String? user;\n\n \/\/\/ password\n String? pass;\n\n \/\/\/server name\n String? name;\n\n \/\/\/ lang??\n String? lang;\n\n \/\/\/ sever version\n String? version;\n\n \/\/\/protocol\n int? protocol;\n\n \/\/\/construcure\n ConnectOption(\n {this.verbose,\n this.pedantic,\n this.auth_token,\n this.user,\n this.pass,\n this.tlsRequired,\n this.name,\n this.lang,\n this.version,\n this.protocol});\n\n \/\/\/constructure from json\n ConnectOption.fromJson(Map json) {\n verbose = json['verbose'];\n pedantic = json['pedantic'];\n tlsRequired = json['tls_required'];\n auth_token = json['auth_token'];\n user = json['user'];\n pass = json['pass'];\n name = json['name'];\n lang = json['lang'];\n version = json['version'];\n protocol = json['protocol'];\n }\n\n \/\/\/export to json\n Map toJson() {\n final data = {};\n data['verbose'] = verbose;\n data['pedantic'] = pedantic;\n data['tls_required'] = tlsRequired;\n data['auth_token'] = auth_token;\n data['user'] = user;\n data['pass'] = pass;\n data['name'] = name;\n data['lang'] = lang;\n data['version'] = version;\n data['protocol'] = protocol;\n\n return _removeNull(data);\n }\n}\n","avg_line_length":19.5337423313,"max_line_length":114,"alphanum_fraction":0.5970477387} {"size":2175,"ext":"dart","lang":"Dart","max_stars_count":2.0,"content":"import 'package:flutter\/cupertino.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter\/scheduler.dart';\nimport 'package:flutter_bili_talk\/db\/hi_cache.dart';\nimport 'package:flutter_bili_talk\/util\/color.dart';\nimport 'package:flutter_bili_talk\/util\/hi_contants.dart';\n\n\/\/\/ \u4f7f\u7528 provider \u7ba1\u7406\u4e3b\u9898\u72b6\u6001\n\n\/\/\/ \u62d3\u5c55\u679a\u4e3e\u7c7b\u578bThemeMode \u65b9\u4fbf\u4fdd\u5b58\u5728\u672c\u5730\nextension ThemeModeExtension on ThemeMode {\n String get value => ['System', 'Light', 'Dark'][index];\n}\n\nclass ThemeProvider extends ChangeNotifier {\n ThemeMode _themeMode;\n var _platformBrightness = SchedulerBinding.instance.window.platformBrightness;\n\n \/\/\/ \u7cfb\u7edf\u4e3b\u9898\u989c\u8272\u53d8\u5316\n void darkModeChange() {\n var curPlatformBrightness =\n SchedulerBinding.instance.window.platformBrightness;\n if (_platformBrightness != curPlatformBrightness) {\n _platformBrightness = curPlatformBrightness;\n notifyListeners();\n }\n }\n\n bool isDark() {\n if (_themeMode == ThemeMode.system) {\n \/\/ \u83b7\u53d6\u7cfb\u7edf\u4e3b\u9898\u7684Dark Mode\n return SchedulerBinding.instance.window.platformBrightness ==\n Brightness.dark;\n }\n return _themeMode == ThemeMode.dark;\n }\n\n ThemeMode getThemeMode() {\n String theme = HiCache.getInstance().get(HiConstants.theme);\n switch (theme) {\n case 'Dark':\n _themeMode = ThemeMode.dark;\n break;\n case 'System':\n _themeMode = ThemeMode.system;\n break;\n default:\n _themeMode = ThemeMode.light;\n break;\n }\n return _themeMode;\n }\n\n \/\/\/ \u8bbe\u7f6e\u4e3b\u9898\n void setTheme(ThemeMode themeMode) {\n HiCache.getInstance().setString(HiConstants.theme, themeMode.value);\n notifyListeners();\n }\n\n ThemeData getTheme({bool isDarkMode = false}) {\n var themeData = ThemeData(\n brightness: isDarkMode ? Brightness.dark : Brightness.light,\n errorColor: isDarkMode ? HiColor.dark_red : HiColor.red,\n primaryColor: isDarkMode ? HiColor.dark_bg : Colors.white,\n accentColor: isDarkMode ? primary[50] : Colors.white, \/\/ \u5f3a\u8c03\u8272\n indicatorColor: isDarkMode ? primary[50] : Colors.white, \/\/ Tab\u6307\u793a\u5668\u4e3b\u9898\u8272\n scaffoldBackgroundColor:\n isDarkMode ? HiColor.dark_bg : Colors.white, \/\/ \u9875\u9762\u80cc\u666f\u8272\n );\n return themeData;\n }\n}\n","avg_line_length":29.7945205479,"max_line_length":80,"alphanum_fraction":0.6937931034} {"size":1078,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/\/ The video file formats available for\n\/\/\/ generating the output trimmed video.\n\/\/\/\n\/\/\/ The available formats are `mp4`, `mkv`,\n\/\/\/ `mov`, `flv`, `avi`, `wmv`& `gif`.\n\/\/\/\n\/\/\/ If you define a custom `FFmpeg` command\n\/\/\/ then this will be ignored.\n\/\/\/\nclass FileFormat {\n const FileFormat._(this.index);\n\n final int index;\n\n static const FileFormat mp4 = FileFormat._(0);\n static const FileFormat mkv = FileFormat._(1);\n static const FileFormat mov = FileFormat._(2);\n static const FileFormat flv = FileFormat._(3);\n static const FileFormat avi = FileFormat._(4);\n static const FileFormat wmv = FileFormat._(5);\n static const FileFormat gif = FileFormat._(6);\n static const FileFormat m3u8 = FileFormat._(7);\n\n static const List values = [\n mp4,\n mkv,\n mov,\n flv,\n avi,\n wmv,\n gif,\n m3u8,\n ];\n\n @override\n String toString() {\n return const {\n 0: '.mp4',\n 1: '.mkv',\n 2: '.mov',\n 3: '.flv',\n 4: '.avi',\n 5: '.wmv',\n 6: '.gif',\n 7: '.m3u8',\n }[index]!;\n }\n}\n","avg_line_length":22.0,"max_line_length":54,"alphanum_fraction":0.5983302412} {"size":967,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/material.dart';\nimport 'package:flutter_easy\/components\/base.dart';\n\nimport '..\/utils\/global_util.dart';\n\nclass PlaceholderView extends StatelessWidget {\n final String title;\n final String image;\n final VoidCallback onTap;\n\n const PlaceholderView({\n Key key,\n this.title = '\u6682\u65e0\u6570\u636e',\n this.image = 'empty',\n this.onTap,\n }) : super(key: key);\n\n @override\n Widget build(BuildContext context) {\n return GestureDetector(\n onTap: onTap,\n child: Container(\n height: 150,\n child: Column(\n children: [\n Image.asset(\n assetsImagesPath(image),\n width: 100,\n height: 100,\n ),\n SizedBox(height: 15),\n BaseText(\n title,\n style: TextStyle(\n color: Colors.black38,\n fontSize: 14,\n ),\n ),\n ],\n ),\n ),\n );\n }\n}\n","avg_line_length":21.4888888889,"max_line_length":51,"alphanum_fraction":0.5232678387} {"size":1549,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"part of traphouse;\n\nclass Bounds {\n\tVector pos;\n\tVector dimensions;\n\t\n\tnum get left => pos.x;\n\tnum get right => pos.x+dimensions.x;\n\t\n\tnum get top => pos.y;\n\tnum get bottom => pos.y+dimensions.y;\n\t\n\tnum get center_x => pos.x+dimensions.x\/2;\n\tnum get center_y => pos.y+dimensions.y\/2;\n\t\n\tBounds(this.dimensions, [this.pos]) {\n\t\tif (this.pos==null)\n\t\t\tthis.pos=new Vector(0,0);\n\t}\n\t\n\tbool intersects_x(Bounds other) => (right>other.left && other.right>left);\n\tbool intersects_y(Bounds other) => (bottom>other.top && other.bottom>top);\n\t\n\tbool intersects(Bounds other) => intersects_x(other) && intersects_y(other);\n\t\n\tBounds clone() => new Bounds(dimensions.clone(),pos.clone());\n\t\n\tnum test_x(Bounds other) {\n\t\tnum shift;\n\t\tif (center_x>other.center_x) {\n\t\t\tshift = other.right-left;\n\t\t\tif (shift<0)\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tshift = other.left-right;\n\t\t\tif (shift>0)\n\t\t\t\treturn 0;\n\t\t}\n\t\treturn shift;\n\t}\n\t\n\tnum test_y(Bounds other) {\n\t\tnum shift;\n\t\tif (center_y>other.center_y) {\n\t\t\tshift = other.bottom-top;\n\t\t\tif (shift<0)\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tshift = other.top-bottom;\n\t\t\tif (shift>0)\n\t\t\t\treturn 0;\n\t\t}\n\t\treturn shift;\n\t}\n\t\n\tint static_collide(Bounds other) {\n\t\tnum shiftX = test_x(other);\n\t\tnum shiftY = test_y(other);\n\t\t\n\t\tif (shiftX!=0 && shiftY!=0) {\n\t\t\tif (shiftX.abs()>shiftY.abs()) {\n\t\t\t\tpos.y+=shiftY;\n\t\t\t\treturn shiftY>0?1:4;\n\t\t\t} else if (shiftX.abs()0?1:4 + shiftX<0?2:8;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}","avg_line_length":20.6533333333,"max_line_length":77,"alphanum_fraction":0.621045836} {"size":8043,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\n\/\/\/ A composable, [Future]-based library for making HTTP requests.\nimport 'dart:convert';\nimport 'dart:typed_data';\n\nimport 'src\/client.dart';\nimport 'src\/exception.dart';\nimport 'src\/progress.dart';\nimport 'src\/request.dart';\nimport 'src\/response.dart';\nimport 'src\/streamed_request.dart';\n\nexport 'src\/base_client.dart';\nexport 'src\/base_request.dart';\nexport 'src\/base_response.dart';\nexport 'src\/byte_stream.dart';\nexport 'src\/client.dart';\nexport 'src\/exception.dart';\nexport 'src\/multipart_file.dart';\nexport 'src\/multipart_request.dart';\nexport 'src\/progress.dart';\nexport 'src\/request.dart';\nexport 'src\/response.dart';\nexport 'src\/streamed_request.dart';\nexport 'src\/streamed_response.dart';\n\n\/\/\/ Sends an HTTP HEAD request with the given headers to the given URL.\n\/\/\/\n\/\/\/ This automatically initializes a new [Client] and closes that client once\n\/\/\/ the request is complete. If you're planning on making multiple requests to\n\/\/\/ the same server, you should use a single [Client] for all of those requests.\n\/\/\/\n\/\/\/ For more fine-grained control over the request, use [Request] instead.\nFuture head(Uri url, {Map? headers}) =>\n _withClient((client) => client.head(url, headers: headers));\n\n\/\/\/ Sends an HTTP GET request with the given headers to the given URL.\n\/\/\/\n\/\/\/ This automatically initializes a new [Client] and closes that client once\n\/\/\/ the request is complete. If you're planning on making multiple requests to\n\/\/\/ the same server, you should use a single [Client] for all of those requests.\n\/\/\/\n\/\/\/ For more fine-grained control over the request, use [Request] instead.\nFuture get(Uri url, {Map? headers}) =>\n _withClient((client) => client.get(url, headers: headers));\n\n\/\/\/ Sends an HTTP POST request with the given headers and body to the given URL.\n\/\/\/\n\/\/\/ [body] sets the body of the request. It can be a [String], a [List] or\n\/\/\/ a [Map]. If it's a String, it's encoded using [encoding] and\n\/\/\/ used as the body of the request. The content-type of the request will\n\/\/\/ default to \"text\/plain\".\n\/\/\/\n\/\/\/ If [body] is a List, it's used as a list of bytes for the body of the\n\/\/\/ request.\n\/\/\/\n\/\/\/ If [body] is a Map, it's encoded as form fields using [encoding]. The\n\/\/\/ content-type of the request will be set to\n\/\/\/ `\"application\/x-www-form-urlencoded\"`; this cannot be overridden.\n\/\/\/\n\/\/\/ [encoding] defaults to [utf8].\n\/\/\/\n\/\/\/ If [onSendProgress] is provided it will be called to indicate\n\/\/\/ the upload progress\n\/\/\/\n\/\/\/ For more fine-grained control over the request, use [Request] or\n\/\/\/ [StreamedRequest] instead.\nFuture post(\n Uri url, {\n Map? headers,\n Object? body,\n Encoding? encoding,\n Progress? onSendProgress,\n}) =>\n _withClient((client) => client.post(\n url,\n headers: headers,\n body: body,\n encoding: encoding,\n onSendProgress: onSendProgress,\n ));\n\n\/\/\/ Sends an HTTP PUT request with the given headers and body to the given URL.\n\/\/\/\n\/\/\/ [body] sets the body of the request. It can be a [String], a [List] or\n\/\/\/ a [Map]. If it's a String, it's encoded using [encoding] and\n\/\/\/ used as the body of the request. The content-type of the request will\n\/\/\/ default to \"text\/plain\".\n\/\/\/\n\/\/\/ If [body] is a List, it's used as a list of bytes for the body of the\n\/\/\/ request.\n\/\/\/\n\/\/\/ If [body] is a Map, it's encoded as form fields using [encoding]. The\n\/\/\/ content-type of the request will be set to\n\/\/\/ `\"application\/x-www-form-urlencoded\"`; this cannot be overridden.\n\/\/\/\n\/\/\/ [encoding] defaults to [utf8].\n\/\/\/\n\/\/\/ If [onSendProgress] is provided it will be called to indicate\n\/\/\/ the upload progress\n\/\/\/\n\/\/\/ For more fine-grained control over the request, use [Request] or\n\/\/\/ [StreamedRequest] instead.\nFuture put(\n Uri url, {\n Map? headers,\n Object? body,\n Encoding? encoding,\n Progress? onSendProgress,\n}) =>\n _withClient((client) => client.put(\n url,\n headers: headers,\n body: body,\n encoding: encoding,\n onSendProgress: onSendProgress,\n ));\n\n\/\/\/ Sends an HTTP PATCH request with the given headers and body to the given\n\/\/\/ URL.\n\/\/\/\n\/\/\/ [body] sets the body of the request. It can be a [String], a [List] or\n\/\/\/ a [Map]. If it's a String, it's encoded using [encoding] and\n\/\/\/ used as the body of the request. The content-type of the request will\n\/\/\/ default to \"text\/plain\".\n\/\/\/\n\/\/\/ If [body] is a List, it's used as a list of bytes for the body of the\n\/\/\/ request.\n\/\/\/\n\/\/\/ If [body] is a Map, it's encoded as form fields using [encoding]. The\n\/\/\/ content-type of the request will be set to\n\/\/\/ `\"application\/x-www-form-urlencoded\"`; this cannot be overridden.\n\/\/\/\n\/\/\/ [encoding] defaults to [utf8].\n\/\/\/\n\/\/\/ If [onSendProgress] is provided it will be called to indicate\n\/\/\/ the upload progress\n\/\/\/\n\/\/\/ For more fine-grained control over the request, use [Request] or\n\/\/\/ [StreamedRequest] instead.\nFuture patch(\n Uri url, {\n Map? headers,\n Object? body,\n Encoding? encoding,\n Progress? onSendProgress,\n}) =>\n _withClient((client) => client.patch(\n url,\n headers: headers,\n body: body,\n encoding: encoding,\n onSendProgress: onSendProgress,\n ));\n\n\/\/\/ Sends an HTTP DELETE request with the given headers to the given URL.\n\/\/\/\n\/\/\/ This automatically initializes a new [Client] and closes that client once\n\/\/\/ the request is complete. If you're planning on making multiple requests to\n\/\/\/ the same server, you should use a single [Client] for all of those requests.\n\/\/\/\n\/\/\/ If [onSendProgress] is provided it will be called to indicate\n\/\/\/ the upload progress\n\/\/\/\n\/\/\/ For more fine-grained control over the request, use [Request] instead.\nFuture delete(\n Uri url, {\n Map? headers,\n Object? body,\n Encoding? encoding,\n Progress? onSendProgress,\n}) =>\n _withClient((client) => client.delete(\n url,\n headers: headers,\n body: body,\n encoding: encoding,\n onSendProgress: onSendProgress,\n ));\n\n\/\/\/ Sends an HTTP GET request with the given headers to the given URL and\n\/\/\/ returns a Future that completes to the body of the response as a [String].\n\/\/\/\n\/\/\/ The Future will emit a [ClientException] if the response doesn't have a\n\/\/\/ success status code.\n\/\/\/\n\/\/\/ This automatically initializes a new [Client] and closes that client once\n\/\/\/ the request is complete. If you're planning on making multiple requests to\n\/\/\/ the same server, you should use a single [Client] for all of those requests.\n\/\/\/\n\/\/\/ For more fine-grained control over the request and response, use [Request]\n\/\/\/ instead.\nFuture read(Uri url, {Map? headers}) =>\n _withClient((client) => client.read(url, headers: headers));\n\n\/\/\/ Sends an HTTP GET request with the given headers to the given URL and\n\/\/\/ returns a Future that completes to the body of the response as a list of\n\/\/\/ bytes.\n\/\/\/\n\/\/\/ The Future will emit a [ClientException] if the response doesn't have a\n\/\/\/ success status code.\n\/\/\/\n\/\/\/ This automatically initializes a new [Client] and closes that client once\n\/\/\/ the request is complete. If you're planning on making multiple requests to\n\/\/\/ the same server, you should use a single [Client] for all of those requests.\n\/\/\/\n\/\/\/ For more fine-grained control over the request and response, use [Request]\n\/\/\/ instead.\nFuture readBytes(Uri url, {Map? headers}) =>\n _withClient((client) => client.readBytes(url, headers: headers));\n\nFuture _withClient(Future Function(Client) fn) async {\n var client = Client();\n try {\n return await fn(client);\n } finally {\n client.close();\n }\n}\n","avg_line_length":36.067264574,"max_line_length":80,"alphanum_fraction":0.6870570683} {"size":649,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/material.dart';\n\nclass MinimumSizeButtonPage extends StatelessWidget {\n const MinimumSizeButtonPage({Key? key}) : super(key: key);\n\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n appBar: AppBar(\n title: const Text('minimum size button'),\n ),\n body: Center(\n child: OutlinedButton(\n style: OutlinedButton.styleFrom(\n minimumSize: const Size(44.0, 44.0),\n tapTargetSize: MaterialTapTargetSize.shrinkWrap,\n ),\n onPressed: () {},\n child: const Text(\n '\u30dc\u30bf\u30f3',\n ),\n ),\n ),\n );\n }\n}\n","avg_line_length":24.037037037,"max_line_length":60,"alphanum_fraction":0.5716486903} {"size":525,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'dart:convert';\n\nimport 'package:commercio_ui\/commercio_ui.dart';\nimport 'package:flutter\/services.dart';\n\nclass KeysRepository {\n final String _demoKeysPath;\n\n const KeysRepository({String? demoKeysPath})\n : _demoKeysPath = demoKeysPath ?? 'assets\/id_keys.json';\n\n Future fetchDemoKeys() async {\n final rsaKeysRaw = await rootBundle.loadString(_demoKeysPath);\n final decodedJson = jsonDecode(rsaKeysRaw) as Map;\n\n return CommercioIdKeys.fromJson(decodedJson);\n }\n}\n","avg_line_length":27.6315789474,"max_line_length":71,"alphanum_fraction":0.7580952381} {"size":2599,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/\n\/\/ ExpandAreaContainer.dart\n\/\/ flutter_templet_project\n\/\/\n\/\/ Created by shang on 12\/14\/21 10:17 AM.\n\/\/ Copyright \u00a9 12\/14\/21 shang. All rights reserved.\n\/\/\n\n\/\/ example code:\n\/\/```\n\/\/ GestureDetectorContainer(\n\/\/ edge: EdgeInsets.all(20),\n\/\/ color: Colors.yellow,\n\/\/ onTap: (){\n\/\/ ddlog(\"onTap\");\n\/\/ },\n\/\/ child: OutlinedButton(\n\/\/ child: Text(\"OutlinedButton\"),\n\/\/ onPressed: (){\n\/\/ ddlog(\"onPressed\");\n\/\/ },\n\/\/ ),\n\/\/ ),\n\/\/```\n\nimport 'package:flutter\/cupertino.dart';\n\nclass GestureDetectorContainer extends StatelessWidget {\n\n const GestureDetectorContainer({\n Key? key,\n required this.child,\n this.edge = const EdgeInsets.all(0),\n this.onTap,\n this.width,\n this.height,\n this.alignment,\n this.color,\n this.decoration,\n this.foregroundDecoration,\n this.margin,\n this.transform,\n this.transformAlignment,\n this.clipBehavior = Clip.none,\n this.constraints,\n }) : super(key: key);\n\n final Widget child;\n\n final EdgeInsets? edge;\n\n final GestureTapCallback? onTap;\n\n final double? width;\n final double? height;\n final BoxConstraints? constraints;\n\n \/\/\/ Align the [child] within the container.\n final AlignmentGeometry? alignment;\n\n \/\/\/ The color to paint behind the [child].\n final Color? color;\n\n \/\/\/ The decoration to paint behind the [child].\n final Decoration? decoration;\n\n \/\/\/ The decoration to paint in front of the [child].\n final Decoration? foregroundDecoration;\n\n \/\/\/ Empty space to surround the [decoration] and [child].\n final EdgeInsetsGeometry? margin;\n\n \/\/\/ The transformation matrix to apply before painting the container.\n final Matrix4? transform;\n\n \/\/\/ The alignment of the origin, relative to the size of the container, if [transform] is specified.\n final AlignmentGeometry? transformAlignment;\n\n \/\/\/ The clip behavior when [Container.decoration] is not null.\n final Clip clipBehavior;\n\n @override\n Widget build(BuildContext context) {\n return GestureDetector(\n \/\/\/\u8fd9\u91cc\u8bbe\u7f6ebehavior\n behavior: HitTestBehavior.translucent,\n onTap: this.onTap,\n child: Container(\n color: this.color,\n alignment: this.alignment,\n padding: this.edge,\n child: this.child,\n decoration: this.decoration,\n foregroundDecoration: this.foregroundDecoration,\n width: this.width,\n height: this.height,\n constraints: this.constraints,\n margin: this.margin,\n transform: this.transform,\n transformAlignment: this.transformAlignment,\n clipBehavior: this.clipBehavior\n ),\n );\n }\n}\n\n\n\n\n","avg_line_length":23.6272727273,"max_line_length":102,"alphanum_fraction":0.665640631} {"size":332,"ext":"dart","lang":"Dart","max_stars_count":43.0,"content":"part of twitter;\n\nString signUpMutation = '''\n mutation signup(\\$fullName: String!, \\$email: String!, \\$password: String!, \\$username: String!, \\$avatar: String) {\n signup(fullName: \\$fullName, email: \\$email, password: \\$password, username: \\$username, avatar: \\$avatar) {\n token\n }\n }\n'''\n .replaceAll('\\n', ' ');\n","avg_line_length":30.1818181818,"max_line_length":118,"alphanum_fraction":0.6144578313} {"size":2355,"ext":"dart","lang":"Dart","max_stars_count":13.0,"content":"import 'dart:io';\n\nimport 'package:flutter_driver\/flutter_driver.dart';\nimport 'package:test_api\/test_api.dart';\n\nvoid main() {\n group(\n 'Automated UI Tests',\n () {\n FlutterDriver driver;\n\n setUpAll(\n () async {\n \/\/ Connects to the app\n driver = await FlutterDriver.connect();\n },\n );\n\n tearDownAll(\n () async {\n if (driver != null) {\n \/\/ Closes the connection\n await driver.close();\n }\n },\n );\n\n test(\n 'Change Temperature',\n () async {\n \/\/ Record the performance timeline of things that happen inside the closure\n Timeline timeline = await driver.traceAction(\n () async {\n await driver.waitFor(find.byValueKey('temp-scale-button'));\n expect(find.byValueKey('temp-scale-button'), isNotNull);\n expect(find.byValueKey('celsius-symbol'), isNotNull);\n await driver.tap(find.byValueKey('temp-scale-button'));\n expect(find.byValueKey('fahrenheit-symbol'), isNotNull);\n await grabScreenshot(driver, 'screenshots\/fahrenheit.png');\n await driver.tap(find.byValueKey('temp-scale-button'));\n expect(find.byValueKey('celsius-symbol'), isNotNull);\n await grabScreenshot(driver, 'screenshots\/celsius.png');\n },\n );\n\n \/\/ The `timeline` object contains all the performance data recorded during\n \/\/ the scrolling session. It can be digested into a handful of useful\n \/\/ aggregate numbers, such as \"average frame build time\".\n TimelineSummary summary = TimelineSummary.summarize(timeline);\n\n \/\/ The following line saves the timeline summary to a JSON file.\n await summary.writeSummaryToFile('change_temp_scale', pretty: true);\n\n \/\/ The following line saves the raw timeline data as JSON.\n await summary.writeTimelineToFile('change_temp_scale', pretty: true);\n },\n );\n },\n );\n}\n\ngrabScreenshot(FlutterDriver driver, String filePath) async {\n final List pixels = await driver.screenshot();\n File file;\n await File('${Directory.current.path}\/$filePath')\n .create(recursive: true)\n .then((f) => file = f);\n await file.writeAsBytes(pixels);\n print('wrote $file');\n}\n","avg_line_length":33.1690140845,"max_line_length":85,"alphanum_fraction":0.6029723992} {"size":4342,"ext":"dart","lang":"Dart","max_stars_count":3.0,"content":"\/\/ Copyright 2014 The Flutter Authors. All rights reserved.\n\/\/ Use of this source code is governed by a BSD-style license that can be\n\/\/ found in the LICENSE file.\n\nimport 'package:flutter\/foundation.dart';\nimport 'package:flutter\/rendering.dart';\nimport 'package:flutter\/widgets.dart';\n\nimport 'tabs.dart';\nimport 'theme.dart';\n\n\/\/\/ Defines a theme for [TabBar] widgets.\n\/\/\/\n\/\/\/ A tab bar theme describes the color of the tab label and the size\/shape of\n\/\/\/ the [TabBar.indicator].\n\/\/\/\n\/\/\/ Descendant widgets obtain the current theme's [TabBarTheme] object using\n\/\/\/ `TabBarTheme.of(context)`. Instances of [TabBarTheme] can be customized with\n\/\/\/ [TabBarTheme.copyWith].\n\/\/\/\n\/\/\/ See also:\n\/\/\/\n\/\/\/ * [TabBar], a widget that displays a horizontal row of tabs.\n\/\/\/ * [ThemeData], which describes the overall theme information for the\n\/\/\/ application.\n@immutable\nclass TabBarTheme with Diagnosticable {\n \/\/\/ Creates a tab bar theme that can be used with [ThemeData.tabBarTheme].\n const TabBarTheme({\n this.indicator,\n this.indicatorSize,\n this.labelColor,\n this.labelPadding,\n this.labelStyle,\n this.unselectedLabelColor,\n this.unselectedLabelStyle,\n });\n\n \/\/\/ Default value for [TabBar.indicator].\n final Decoration indicator;\n\n \/\/\/ Default value for [TabBar.indicatorSize].\n final TabBarIndicatorSize indicatorSize;\n\n \/\/\/ Default value for [TabBar.labelColor].\n final Color labelColor;\n\n \/\/\/ Default value for [TabBar.labelPadding].\n final EdgeInsetsGeometry labelPadding;\n\n \/\/\/ Default value for [TabBar.labelStyle].\n final TextStyle labelStyle;\n\n \/\/\/ Default value for [TabBar.unselectedLabelColor].\n final Color unselectedLabelColor;\n\n \/\/\/ Default value for [TabBar.unselectedLabelStyle].\n final TextStyle unselectedLabelStyle;\n\n \/\/\/ Creates a copy of this object but with the given fields replaced with the\n \/\/\/ new values.\n TabBarTheme copyWith({\n Decoration indicator,\n TabBarIndicatorSize indicatorSize,\n Color labelColor,\n EdgeInsetsGeometry labelPadding,\n TextStyle labelStyle,\n Color unselectedLabelColor,\n TextStyle unselectedLabelStyle,\n }) {\n return TabBarTheme(\n indicator: indicator ?? this.indicator,\n indicatorSize: indicatorSize ?? this.indicatorSize,\n labelColor: labelColor ?? this.labelColor,\n labelPadding: labelPadding ?? this.labelPadding,\n labelStyle: labelStyle ?? this.labelStyle,\n unselectedLabelColor: unselectedLabelColor ?? this.unselectedLabelColor,\n unselectedLabelStyle: unselectedLabelStyle ?? this.unselectedLabelStyle,\n );\n }\n\n \/\/\/ The data from the closest [TabBarTheme] instance given the build context.\n static TabBarTheme of(BuildContext context) {\n return Theme.of(context).tabBarTheme;\n }\n\n \/\/\/ Linearly interpolate between two tab bar themes.\n \/\/\/\n \/\/\/ The arguments must not be null.\n \/\/\/\n \/\/\/ {@macro dart.ui.shadow.lerp}\n static TabBarTheme lerp(TabBarTheme a, TabBarTheme b, double t) {\n assert(a != null);\n assert(b != null);\n assert(t != null);\n return TabBarTheme(\n indicator: Decoration.lerp(a.indicator, b.indicator, t),\n indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize,\n labelColor: Color.lerp(a.labelColor, b.labelColor, t),\n labelPadding: EdgeInsetsGeometry.lerp(a.labelPadding, b.labelPadding, t),\n labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t),\n unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t),\n unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t),\n );\n }\n\n @override\n int get hashCode {\n return hashValues(\n indicator,\n indicatorSize,\n labelColor,\n labelPadding,\n labelStyle,\n unselectedLabelColor,\n unselectedLabelStyle,\n );\n }\n\n @override\n bool operator ==(Object other) {\n if (identical(this, other))\n return true;\n if (other.runtimeType != runtimeType)\n return false;\n return other is TabBarTheme\n && other.indicator == indicator\n && other.indicatorSize == indicatorSize\n && other.labelColor == labelColor\n && other.labelPadding == labelPadding\n && other.labelStyle == labelStyle\n && other.unselectedLabelColor == unselectedLabelColor\n && other.unselectedLabelStyle == unselectedLabelStyle;\n }\n}\n","avg_line_length":31.9264705882,"max_line_length":94,"alphanum_fraction":0.7058959005} {"size":2249,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/material.dart';\n\nimport 'intro_slide.dart';\n\nclass Intro extends StatelessWidget {\n static const routeName = 'intro';\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n body: SafeArea(\n child: SingleChildScrollView(\n child: Container(\n alignment: Alignment.center,\n child: Column(\n children: [\n IntroSlide(),\n Container(\n width: 300,\n height: 47,\n decoration: BoxDecoration(\n borderRadius: BorderRadius.circular(30.0),\n boxShadow: [\n BoxShadow(\n color: Color(0xFF3C4858).withOpacity(.4),\n offset: Offset(10.0, 10.0),\n blurRadius: 10.0),\n ],\n ),\n child: RaisedButton(\n color: Color(0xFF3C4858),\n shape: RoundedRectangleBorder(\n borderRadius: BorderRadius.circular(30.0)),\n onPressed: () {\n Navigator.of(context).pushNamed('signup');\n },\n child: Text(\n 'Create Account',\n style: TextStyle(color: Colors.white, fontSize: 18.0),\n ),\n ),\n ),\n Container(\n width: 300,\n height: 47,\n margin: EdgeInsets.only(top: 20.0),\n child: FlatButton(\n color: Colors.white,\n shape: RoundedRectangleBorder(\n side: BorderSide(color: Color(0xFFC4C4C4), width: 1.2),\n borderRadius: BorderRadius.circular(30.0)),\n onPressed: () {\n Navigator.of(context).pushNamed('login');\n },\n child: Text(\n 'Login',\n style: TextStyle(fontSize: 18.0),\n ),\n ),\n ),\n ],\n ),\n ),\n ),\n ),\n );\n }\n}","avg_line_length":33.5671641791,"max_line_length":79,"alphanum_fraction":0.4028457092} {"size":3685,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ GENERATED CODE - DO NOT MODIFY BY HAND\n\npart of 'order_detail_entity.dart';\n\n\/\/ **************************************************************************\n\/\/ JsonSerializableGenerator\n\/\/ **************************************************************************\n\nOrderDetailEntity _$OrderDetailEntityFromJson(Map json) {\n return OrderDetailEntity(json['orderInfo'] == null ? null : OrderInfo.fromJson(json['orderInfo'] as Map),\n (json['orderGoods'] as List)?.map((e) => e == null ? null : OrderGoods.fromJson(e as Map))?.toList());\n}\n\nMap _$OrderDetailEntityToJson(OrderDetailEntity instance) => {'orderInfo': instance.orderInfo, 'orderGoods': instance.orderGoods};\n\nOrderInfo _$OrderInfoFromJson(Map json) {\n return OrderInfo(\n json['consignee'] as String,\n json['address'] as String,\n json['addTime'] as String,\n json['orderSn'] as String,\n (json['actualPrice'] as num)?.toDouble(),\n json['mobile'] as String,\n json['orderStatusText'] as String,\n (json['goodsPrice'] as num)?.toDouble(),\n (json['couponPrice'] as num)?.toDouble(),\n json['id'] as int,\n (json['freightPrice'] as num)?.toDouble(),\n json['handleOption'] == null ? null : HandleOption.fromJson(json['handleOption'] as Map));\n}\n\nMap _$OrderInfoToJson(OrderInfo instance) => {\n 'consignee': instance.consignee,\n 'address': instance.address,\n 'addTime': instance.addTime,\n 'orderSn': instance.orderSn,\n 'actualPrice': instance.actualPrice,\n 'mobile': instance.mobile,\n 'orderStatusText': instance.orderStatusText,\n 'goodsPrice': instance.goodsPrice,\n 'couponPrice': instance.couponPrice,\n 'id': instance.id,\n 'freightPrice': instance.freightPrice,\n 'handleOption': instance.handleOption\n };\n\nHandleOption _$HandleOptionFromJson(Map json) {\n return HandleOption(json['cancel'] as bool, json['delete'] as bool, json['pay'] as bool, json['comment'] as bool, json['confirm'] as bool, json['refund'] as bool, json['rebuy'] as bool);\n}\n\nMap _$HandleOptionToJson(HandleOption instance) => {\n 'cancel': instance.cancel,\n 'delete': instance.delete,\n 'pay': instance.pay,\n 'comment': instance.comment,\n 'confirm': instance.confirm,\n 'refund': instance.refund,\n 'rebuy': instance.rebuy\n };\n\nOrderGoods _$OrderGoodsFromJson(Map json) {\n return OrderGoods(\n json['id'] as int,\n json['orderId'] as int,\n json['goodsId'] as int,\n json['goodsName'] as String,\n json['goodsSn'] as String,\n json['productId'] as int,\n json['number'] as int,\n (json['price'] as num)?.toDouble(),\n (json['specifications'] as List)?.map((e) => e as String)?.toList(),\n json['picUrl'] as String,\n json['comment'] as int,\n json['addTime'] as String,\n json['updateTime'] as String,\n json['deleted'] as bool);\n}\n\nMap _$OrderGoodsToJson(OrderGoods instance) => {\n 'id': instance.id,\n 'orderId': instance.orderId,\n 'goodsId': instance.goodsId,\n 'goodsName': instance.goodsName,\n 'goodsSn': instance.goodsSn,\n 'productId': instance.productId,\n 'number': instance.number,\n 'price': instance.price,\n 'specifications': instance.specifications,\n 'picUrl': instance.picUrl,\n 'comment': instance.comment,\n 'addTime': instance.addTime,\n 'updateTime': instance.updateTime,\n 'deleted': instance.deleted\n };\n","avg_line_length":38.7894736842,"max_line_length":188,"alphanum_fraction":0.6279511533} {"size":3964,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/material.dart';\nimport 'package:my_movie_app\/widgets\/horizontal_list_item.dart';\nimport 'package:my_movie_app\/widgets\/top_rated_list_item.dart';\nimport 'package:my_movie_app\/widgets\/vertical_list_item.dart';\nimport 'package:my_movie_app\/models\/movie.dart';\n\nclass Dashboard extends StatelessWidget {\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n appBar: AppBar(\n title: Text('Movie App'),\n actions: [\n IconButton(\n icon: Icon(Icons.search),\n onPressed: () {},\n ),\n ],\n ),\n body: SingleChildScrollView(\n child: Column(\n children: [\n Padding(\n padding: const EdgeInsets.symmetric(horizontal: 10),\n child: Row(\n mainAxisAlignment: MainAxisAlignment.spaceBetween,\n children: [\n Text(\n 'Recommended',\n style: TextStyle(\n fontSize: 18,\n fontWeight: FontWeight.bold,\n ),\n ),\n FlatButton(\n child: Text('View'),\n onPressed: () {},\n )\n ],\n ),\n ),\n Container(\n height: 280.0,\n child: ListView.builder(\n scrollDirection: Axis.horizontal,\n itemCount: movieList.length,\n itemBuilder: (ctx, i) => HorizontalListItem(i),\n \/\/ children: [\n \/\/ HorizontalList(),\n \/\/ HorizontalList(),\n \/\/ HorizontalList(),\n \/\/ ],\n ),\n ),\n SizedBox(\n height: 30,\n ),\n Padding(\n padding: const EdgeInsets.symmetric(horizontal: 10),\n child: Row(\n mainAxisAlignment: MainAxisAlignment.spaceBetween,\n children: [\n Text(\n 'Best Of 2021',\n style: TextStyle(\n fontSize: 18,\n fontWeight: FontWeight.bold,\n ),\n ),\n FlatButton(\n child: Text('View'),\n onPressed: () {},\n )\n ],\n ),\n ),\n Container(\n height: 500,\n padding: const EdgeInsets.symmetric(horizontal: 10),\n child: ListView.builder(\n physics: NeverScrollableScrollPhysics(),\n itemCount: bestMovieList.length,\n itemBuilder: (ctx, i) => VerticalListItem(i),\n \/\/ children: [\n \/\/ VerticalList(),\n \/\/ VerticalList(),\n \/\/ VerticalList(),\n \/\/ ],\n ),\n ),\n SizedBox(\n height: 30,\n ),\n Padding(\n padding: const EdgeInsets.symmetric(horizontal: 10),\n child: Row(\n mainAxisAlignment: MainAxisAlignment.spaceBetween,\n children: [\n Text(\n 'Top Rated',\n style: TextStyle(\n fontSize: 18,\n fontWeight: FontWeight.bold,\n ),\n ),\n FlatButton(\n child: Text('View'),\n onPressed: () {},\n )\n ],\n ),\n ),\n Container(\n height: 280.0,\n child: ListView.builder(\n scrollDirection: Axis.horizontal,\n itemCount: topRatedMovieList.length,\n itemBuilder: (ctx, i) => TopRatedListItem(i),\n ),\n ),\n ],\n ),\n ),\n );\n }\n}\n","avg_line_length":31.2125984252,"max_line_length":66,"alphanum_fraction":0.4086781029} {"size":3050,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/*\n * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file\n * for details. All rights reserved. Use of this source code is governed by a\n * BSD-style license that can be found in the LICENSE file.\n *\/\n\/**\n * @assertion Instantiate to bound then computes an actual type argument list\n * for [G] as follows:\n *\n * Let [Ui],[1] be [Si], for all [i] in [1 .. k]. (This is the \"current value\"\n * of the bound for type variable [i], at step [1]; in general we will\n * consider the current step, [m], and use data for that step, e.g., the bound\n * [Ui],[m], to compute the data for step [m + 1]).\n *\n * Let [-->m] be a relation among the type variables [X1 .. Xk] such that\n * [Xp -->m Xq] iff [Xq] occurs in [Up],[m] (so each type variable is related\n * to, that is, depends on, every type variable in its bound, possibly\n * including itself). Let [==>m] be the transitive closure of [-->m]. For each\n * [m], let [Ui],[m+1], for [i] in [1 .. k], be determined by the following\n * iterative process:\n *\n * 1. If there exists a [j] in [1 .. k] such that [Xj ==>m X0j] (that is, if\n * the dependency graph has a cycle) let [M1 .. Mp] be the strongly connected\n * components (SCCs) with respect to [-->m] (that is, the maximal subsets of\n * [X1 .. Xk] where every pair of variables in each subset are related in both\n * directions by [==>m]; note that the SCCs are pairwise disjoint; also, they\n * are uniquely defined up to reordering, and the order does not matter). Let\n * [M] be the union of [M1 .. Mp] (that is, all variables that participate in\n * a dependency cycle). Let [i] be in [1 .. k]. If [Xi] does not belong to [M]\n * then [Ui,m+1 = Ui,m]. Otherwise there exists a [q] such that [Xi] belongs\n * to [Mq]; [Ui,m+1] is then obtained from [Ui,m] by replacing every covariant\n * occurrence of a variable in [Mq] by [dynamic], and replacing every\n * contravariant occurrence of a variable in [Mq] by [Null].\n *\n * 2. Otherwise, (if no dependency cycle exists) let [j] be the lowest number\n * such that [Xj] occurs in [Up,m] for some [p] and [Xj -\/->m Xq] for all [q]\n * in [1..k] (that is, [Uj,m] is closed, that is, the current bound of [Xj]\n * does not contain any type variables; but [Xj] is being depended on by the\n * bound of some other type variable). Then, for all [i] in [1 .. k], [Ui,m+1]\n * is obtained from [Ui,m] by replacing every covariant occurrence of [Xj] by\n * [Uj,m], and replacing every contravariant occurrence of [Xj] by [Null].\n *\n * 3. Otherwise, (when no dependencies exist) terminate with the result\n * [].\n * @description Checks instantiation to bounds for [typedef A?> = C]\n * @author iarkh@unipro.ru\n *\/\n\/\/ SharedOptions=--enable-experiment=nonfunction-type-aliases,non-nullable\n\nimport \"dart:async\";\nimport \"..\/..\/..\/..\/Utils\/expect.dart\";\n\nclass C {}\ntypedef A?>> = C;\n\nmain() {\n Expect.equals(\n typeOf?>>>(),\n typeOf()\n );\n}\n","avg_line_length":48.4126984127,"max_line_length":80,"alphanum_fraction":0.6475409836} {"size":1069,"ext":"dart","lang":"Dart","max_stars_count":2.0,"content":"\/\/\/ Always sort imports like below format\n\/\/\/\n\/\/\/ 1. Dart packages (eg. dart.io)\n\/\/\/ 2. Flutter packages (eg. material)\n\/\/\/ 3. Third party packages (eg. google_maps)\n\/\/\/ 4. Constants (eg. keys.dart)\n\/\/\/ 5. Providers (eg. location_provider)\n\/\/\/ 6. Services (eg. location_service)\n\/\/\/ 7. Layouts (eg. loader_wrap.dart)\n\/\/\/ 8. Components (eg. custom_button.dart)\n\/\/\/ 9. Pages (eg. home.dart)\n\nimport 'package:flutter\/widgets.dart';\n\nimport 'package:catcher\/catcher_plugin.dart';\n\nimport 'package:music_stories\/src\/constants\/keys.dart';\n\nimport 'package:music_stories\/src\/app.dart';\n\nvoid main() {\n \/\/ I don't like the way catcher showing error logs in the console. \ud83d\ude10\n bool isDebug = false;\n \/\/ Assert works only in debug mode. So if it is running in production,\n \/\/ the `isDebug` variable will be false and excecute catcher code.\n assert(isDebug = true);\n \n if (isDebug) {\n runApp(App());\n } else {\n Catcher(\n App(),\n releaseConfig: CatcherOptions(\n DialogReportMode(),\n [SentryHandler(KeysConstant.sentryDsn)],\n ),\n );\n }\n}\n","avg_line_length":26.725,"max_line_length":72,"alphanum_fraction":0.6669784846} {"size":9939,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"part of logger_flutter;\n\nclass _WrappedOutput implements LogOutput {\n final Function(OutputEvent e) outputListener;\n final LogOutput innerLogOutput;\n\n _WrappedOutput(this.outputListener, this.innerLogOutput);\n\n @override\n void output(OutputEvent event) {\n innerLogOutput.output(event);\n outputListener(event);\n }\n\n @override\n void destroy() {\n innerLogOutput.destroy();\n }\n\n @override\n void init() {\n innerLogOutput.init();\n }\n}\n\nclass LogConsole extends StatefulWidget {\n final bool dark;\n final bool showCloseButton;\n\n static ListQueue _outputEventBuffer = ListQueue();\n static bool _initialized = false;\n static final _newLogs = ChangeNotifier();\n\n LogConsole({this.dark = false, this.showCloseButton = false})\n : assert(_initialized, 'Please call LogConsole.init() first.');\n\n \/\/\/ Attach this LogOutput to your logger instance:\n \/\/\/ `\n \/\/\/ Logger(\n \/\/\/ printer: PrettyPrinter(\n \/\/\/ printTime: true,\n \/\/\/ printEmojis: true,\n \/\/\/ colors: true,\n \/\/\/ methodCount: methodCount,\n \/\/\/ errorMethodCount: errMethodCount,\n \/\/\/ ),\n \/\/\/ level: level,\n \/\/\/ output: LogConsole.wrap(output),\n \/\/\/ filter: ProductionFiler(),\n \/\/\/ );\n \/\/\/ `\n static LogOutput wrap({int bufferSize = 1000, LogOutput? innerOutput}) {\n _initialized = true;\n\n final output = innerOutput ?? ConsoleOutput();\n\n return _WrappedOutput((e) {\n if (_outputEventBuffer.length == bufferSize) {\n _outputEventBuffer.removeFirst();\n }\n _outputEventBuffer.add(e);\n \/\/ ignore: invalid_use_of_visible_for_testing_member, invalid_use_of_protected_member\n _newLogs.notifyListeners();\n }, output);\n }\n\n @override\n _LogConsoleState createState() => _LogConsoleState();\n\n static void openLogConsole(BuildContext context, {bool? dark}) async {\n var logConsole = LogConsole(\n showCloseButton: true,\n dark:dark ?? Theme.of(context).brightness == Brightness.dark,\n );\n PageRoute route;\n route = MaterialPageRoute(builder: (_) => logConsole);\n\n await Navigator.push(context, route);\n }\n}\n\nclass RenderedEvent {\n final int id;\n final Level level;\n final String text;\n\n RenderedEvent(this.id, this.level, this.text);\n}\n\nclass _LogConsoleState extends State {\n final ListQueue _renderedBuffer = ListQueue();\n List _filteredBuffer = [];\n\n final _scrollController = ScrollController();\n final _filterController = TextEditingController();\n\n Level _filterLevel = Level.verbose;\n double _logFontSize = 14;\n\n var _currentId = 0;\n bool _scrollListenerEnabled = true;\n bool _followBottom = true;\n\n @override\n void initState() {\n super.initState();\n\n _scrollController.addListener(() {\n if (!_scrollListenerEnabled) return;\n var scrolledToBottom = _scrollController.offset >=\n _scrollController.position.maxScrollExtent;\n setState(() {\n _followBottom = scrolledToBottom;\n });\n });\n\n LogConsole._newLogs.addListener(_onNewLogs);\n }\n\n void _onNewLogs() {\n setState(() {\n _reloadContent();\n });\n }\n\n @override\n void didChangeDependencies() {\n super.didChangeDependencies();\n\n _reloadContent();\n }\n\n void _reloadContent() {\n _renderedBuffer.clear();\n for (var event in LogConsole._outputEventBuffer) {\n _renderedBuffer.add(_renderEvent(event));\n }\n _refreshFilter();\n }\n\n void _refreshFilter() {\n var newFilteredBuffer = _renderedBuffer.where((it) {\n var logLevelMatches = it.level.index >= _filterLevel.index;\n if (!logLevelMatches) {\n return false;\n } else if (_filterController.text.isNotEmpty) {\n var filterText = _filterController.text.toLowerCase();\n return it.text.toLowerCase().contains(filterText);\n } else {\n return true;\n }\n }).toList();\n setState(() {\n _filteredBuffer = newFilteredBuffer;\n });\n\n if (_followBottom) {\n Future.delayed(Duration.zero, _scrollToBottom);\n }\n }\n\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n debugShowCheckedModeBanner: false,\n theme: widget.dark\n ? ThemeData(\n brightness: Brightness.dark,\n accentColor: Colors.blueGrey,\n )\n : ThemeData(\n brightness: Brightness.light,\n accentColor: Colors.lightBlueAccent,\n ),\n home: Scaffold(\n body: SafeArea(\n child: Column(\n crossAxisAlignment: CrossAxisAlignment.stretch,\n children: [\n _buildTopBar(),\n Expanded(\n child: _buildLogContent(),\n ),\n _buildBottomBar(),\n ],\n ),\n ),\n floatingActionButton: AnimatedOpacity(\n opacity: _followBottom ? 0 : 1,\n duration: Duration(milliseconds: 150),\n child: Padding(\n padding: EdgeInsets.only(bottom: 60),\n child: FloatingActionButton(\n mini: true,\n clipBehavior: Clip.antiAlias,\n child: Icon(\n Icons.arrow_downward,\n color: widget.dark ? Colors.white : Colors.lightBlue[900],\n ),\n onPressed: _scrollToBottom,\n ),\n ),\n ),\n ),\n );\n }\n\n Widget _buildLogContent() {\n final text = StringBuffer();\n _filteredBuffer.forEach((e) {\n text.write(e.text);\n text.write('\\n');\n });\n\n return Container(\n color: widget.dark ? Colors.black : Colors.grey[150],\n child: SingleChildScrollView(\n scrollDirection: Axis.vertical,\n controller: _scrollController,\n child: SingleChildScrollView(\n scrollDirection: Axis.horizontal,\n child: SizedBox(\n width: 1600,\n child: SelectableText(\n text.toString(),\n style: TextStyle(fontSize: _logFontSize),\n ),\n ),\n ),\n ),\n );\n }\n\n Widget _buildTopBar() {\n return LogBar(\n dark: widget.dark,\n child: Row(\n mainAxisSize: MainAxisSize.max,\n children: [\n Text(\n 'Log Console',\n style: TextStyle(\n fontSize: 20,\n fontWeight: FontWeight.bold,\n ),\n ),\n Spacer(),\n IconButton(\n icon: Icon(Icons.add),\n onPressed: () {\n setState(() {\n _logFontSize++;\n });\n },\n ),\n IconButton(\n icon: Icon(Icons.remove),\n onPressed: () {\n setState(() {\n _logFontSize--;\n });\n },\n ),\n if (widget.showCloseButton)\n IconButton(\n icon: Icon(Icons.close),\n onPressed: () {\n Navigator.pop(context);\n },\n ),\n ],\n ),\n );\n }\n\n Widget _buildBottomBar() {\n return LogBar(\n dark: widget.dark,\n child: Row(\n mainAxisSize: MainAxisSize.max,\n children: [\n Expanded(\n child: TextField(\n style: TextStyle(fontSize: 20),\n controller: _filterController,\n onChanged: (s) => _refreshFilter(),\n decoration: InputDecoration(\n labelText: 'Filter log output',\n border: OutlineInputBorder(),\n ),\n ),\n ),\n SizedBox(width: 20),\n DropdownButton(\n value: _filterLevel,\n items: [\n DropdownMenuItem(\n child: Text('VERBOSE'),\n value: Level.verbose,\n ),\n DropdownMenuItem(\n child: Text('DEBUG'),\n value: Level.debug,\n ),\n DropdownMenuItem(\n child: Text('INFO'),\n value: Level.info,\n ),\n DropdownMenuItem(\n child: Text('WARNING'),\n value: Level.warning,\n ),\n DropdownMenuItem(\n child: Text('ERROR'),\n value: Level.error,\n ),\n DropdownMenuItem(\n child: Text('WTF'),\n value: Level.wtf,\n )\n ],\n onChanged: (value) {\n _filterLevel = value as Level;\n _refreshFilter();\n },\n )\n ],\n ),\n );\n }\n\n void _scrollToBottom() async {\n _scrollListenerEnabled = false;\n\n setState(() {\n _followBottom = true;\n });\n\n var scrollPosition = _scrollController.position;\n await _scrollController.animateTo(\n scrollPosition.maxScrollExtent,\n duration: Duration(milliseconds: 400),\n curve: Curves.easeOut,\n );\n\n _scrollListenerEnabled = true;\n }\n\n RenderedEvent _renderEvent(OutputEvent event) {\n var text = event.lines.join('\\n');\n return RenderedEvent(\n _currentId++,\n event.level,\n text,\n );\n }\n\n @override\n void dispose() {\n LogConsole._newLogs.removeListener(_onNewLogs);\n super.dispose();\n }\n}\n\nclass LogBar extends StatelessWidget {\n final bool dark;\n final Widget child;\n\n LogBar({this.dark = false, required this.child});\n\n @override\n Widget build(BuildContext context) {\n return SizedBox(\n height: 60,\n child: Container(\n decoration: BoxDecoration(\n boxShadow: [\n if (!dark)\n BoxShadow(\n color: Colors.grey[400]!,\n blurRadius: 3,\n ),\n ],\n ),\n child: Material(\n color: dark ? Colors.blueGrey[900] : Colors.white,\n child: Padding(\n padding: EdgeInsets.fromLTRB(15, 8, 15, 8),\n child: child,\n ),\n ),\n ),\n );\n }\n}\n","avg_line_length":25.0984848485,"max_line_length":91,"alphanum_fraction":0.5528725224} {"size":4641,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'dart:math';\n\nimport 'package:flutter_custom_calendar\/model\/date_model.dart';\n\n\/**\n * \u5de5\u5177\u7c7b\n *\/\nclass DateUtil {\n \/**\n * \u5224\u65ad\u4e00\u4e2a\u65e5\u671f\u662f\u5426\u662f\u5468\u672b\uff0c\u5373\u5468\u516d\u65e5\n *\/\n static bool isWeekend(DateTime dateTime) {\n return dateTime.weekday == DateTime.saturday ||\n dateTime.weekday == DateTime.sunday;\n }\n\n \/**\n * \u83b7\u53d6\u67d0\u6708\u7684\u5929\u6570\n *\n * @param year \u5e74\n * @param month \u6708\n * @return \u67d0\u6708\u7684\u5929\u6570\n *\/\n static int getMonthDaysCount(int year, int month) {\n int count = 0;\n \/\/\u5224\u65ad\u5927\u6708\u4efd\n if (month == 1 ||\n month == 3 ||\n month == 5 ||\n month == 7 ||\n month == 8 ||\n month == 10 ||\n month == 12) {\n count = 31;\n }\n\n \/\/\u5224\u65ad\u5c0f\u6708\n if (month == 4 || month == 6 || month == 9 || month == 11) {\n count = 30;\n }\n\n \/\/\u5224\u65ad\u5e73\u5e74\u4e0e\u95f0\u5e74\n if (month == 2) {\n if (isLeapYear(year)) {\n count = 29;\n } else {\n count = 28;\n }\n }\n return count;\n }\n\n \/**\n * \u662f\u5426\u662f\u4eca\u5929\n *\/\n static bool isCurrentDay(int year, int month, int day) {\n return new DateTime(year, month, day).difference(DateTime.now()).inDays ==\n 0;\n }\n\n \/**\n * \u662f\u5426\u662f\u95f0\u5e74\n *\/\n static bool isLeapYear(int year) {\n return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);\n }\n\n \/**\n * \u672c\u6708\u7684\u7b2c\u51e0\u5468\n *\/\n static int getIndexWeekInMonth(DateTime dateTime) {\n DateTime firstdayInMonth = new DateTime(dateTime.year, dateTime.month, 1);\n Duration duration = dateTime.difference(firstdayInMonth);\n return (duration.inDays \/ 7).toInt() + 1;\n }\n\n \/**\n * \u672c\u5468\u7684\u7b2c\u51e0\u5929\n *\/\n static int getIndexDayInWeek(DateTime dateTime) {\n DateTime firstdayInMonth = new DateTime(\n dateTime.year,\n dateTime.month,\n );\n Duration duration = dateTime.difference(firstdayInMonth);\n return (duration.inDays \/ 7).toInt() + 1;\n }\n\n \/**\n * \u672c\u6708\u7b2c\u4e00\u5929\uff0c\u662f\u90a3\u4e00\u5468\u7684\u7b2c\u51e0\u5929,\u4ece1\u5f00\u59cb\n * @return \u83b7\u53d6\u65e5\u671f\u6240\u5728\u6708\u89c6\u56fe\u5bf9\u5e94\u7684\u8d77\u59cb\u504f\u79fb\u91cf the start diff with MonthView\n *\/\n static int getIndexOfFirstDayInMonth(DateTime dateTime) {\n DateTime firstDayOfMonth = new DateTime(dateTime.year, dateTime.month, 1);\n \/\/\/\u8ba1\u7b97\u662f\u5468\u51e0\n int week = firstDayOfMonth.weekday;\n return week;\n }\n\n static List initCalendarForMonthView(\n int year, int month, DateTime currentDate, int weekStart,\n {DateModel minSelectDate,\n DateModel maxSelectDate,\n Map extraDataMap}) {\n \/\/\/\u5468\u51e0\u5f00\u59cb\n weekStart = DateTime.monday;\n \/\/\u83b7\u53d6\u6708\u89c6\u56fe\u5176\u5b9e\u504f\u79fb\u91cf\n int mPreDiff = getIndexOfFirstDayInMonth(new DateTime(year, month));\n \/\/\u83b7\u53d6\u8be5\u6708\u7684\u5929\u6570\n int monthDayCount = getMonthDaysCount(year, month);\n\n print(\"$year\u5e74$month\u6708,\u6709$monthDayCount\u5929,\u7b2c\u4e00\u5929\u7684index\u4e3a${mPreDiff}\");\n\n List result = new List();\n\n \/\/\/6(\u884c\u6570)*7(\u5468)\n int size = 42;\n\n \/\/\/\u5f53\u524d\u6708\u4efd\u7b2c\u4e00\u5929\n DateTime firstDayOfMonth = new DateTime(year, month, 1);\n \/\/\/\u5f53\u524d\u6708\u4efd\u6700\u540e\u4e00\u5929\n DateTime lastDayOfMonth = new DateTime(year, month, monthDayCount);\n\n for (int i = 0; i < size; i++) {\n DateTime temp;\n DateModel dateModel;\n if (i < mPreDiff - 1) {\n \/\/\/\u8ba1\u7b97\u591a\u5c11\u5929\u4e4b\u524d\u7684\u65f6\u95f4\n temp = firstDayOfMonth.subtract(Duration(days: mPreDiff - i - 1));\n dateModel = DateModel.fromDateTime(temp);\n \/\/\u8fd9\u4e2a\u4e0a\u4e00\u6708\u7684\u51e0\u5929\n } else if (i >= monthDayCount + (mPreDiff - 1)) {\n temp = lastDayOfMonth\n .add(Duration(days: i - mPreDiff - monthDayCount + 2));\n dateModel = DateModel.fromDateTime(temp);\n \/\/\u8fd9\u662f\u4e0b\u4e00\u6708\u7684\u51e0\u5929\n } else {\n \/\/\u8fd9\u4e2a\u6708\u7684\n temp = new DateTime(year, month, i - mPreDiff + 2);\n dateModel = DateModel.fromDateTime(temp);\n }\n\n \/\/\u5224\u65ad\u662f\u5426\u5728\u8303\u56f4\u5185\n if (dateModel.getDateTime().isAfter(minSelectDate.getDateTime()) &&\n dateModel.getDateTime().isBefore(maxSelectDate.getDateTime())) {\n dateModel.isInRange = true;\n } else {\n dateModel.isInRange = false;\n }\n \/\/\u5c06\u81ea\u5b9a\u4e49\u989d\u5916\u7684\u6570\u636e\uff0c\u5b58\u50a8\u5230\u76f8\u5e94\u7684model\u4e2d\n if (extraDataMap != null && extraDataMap.isNotEmpty) {\n DateTime dateTime = dateModel.getDateTime();\n if (extraDataMap.containsKey(dateTime)) {\n dateModel.extraData = extraDataMap[dateTime];\n }\n }\n\n result.add(dateModel);\n }\n\n return result;\n }\n\n \/**\n * \u6708\u7684\u884c\u6570\n *\/\n static int getMonthViewLineCount(int year, int month) {\n \/\/\/\u5f53\u524d\u6708\u7b2c\u4e00\u5929\n DateTime firstDayOfMonth = new DateTime(year, month, 1);\n \/\/\/\u8ba1\u7b97\u5f53\u524d\u6708\u4efd\u5929\u6570\n int monthDayCount = getMonthDaysCount(year, month);\n\/\/ DateTime lastDayOfMonth = new DateTime(year, month, monthDayCount);\n \/\/\/\u8ba1\u7b97\u5468\u51e0\n int preIndex = firstDayOfMonth.weekday - 1;\n\/\/ int lastIndex = lastDayOfMonth.weekday;\n\n print(\"$year\u5e74$month\u6708:\u6709${((preIndex + monthDayCount) \/ 7).toInt() + 1}\u884c\");\n \/\/\/\u8ba1\u7b97\u884c\u6570\n return ((preIndex + monthDayCount) \/ 7).toInt() + 1;\n }\n}\n","avg_line_length":25.5,"max_line_length":78,"alphanum_fraction":0.6000861883} {"size":7204,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ IMetaDataImport2.dart\n\n\/\/ THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY.\n\n\/\/ ignore_for_file: unused_import\n\nimport 'dart:ffi';\n\nimport 'package:ffi\/ffi.dart';\n\nimport '..\/com\/combase.dart';\nimport '..\/constants.dart';\nimport '..\/constants_nodoc.dart';\nimport '..\/exceptions.dart';\nimport '..\/macros.dart';\nimport '..\/ole32.dart';\nimport '..\/structs.dart';\n\nimport 'IMetaDataImport.dart';\n\n\/\/\/ @nodoc\nconst IID_IMetaDataImport2 = '{FCE5EFA0-8BBA-4f8E-A036-8F2022B08466}';\n\ntypedef _EnumGenericParams_Native = Int32 Function(\n Pointer obj,\n Pointer phEnum,\n Uint32 tk,\n Pointer rGenericParams,\n Uint32 cMax,\n Pointer pcGenericParams);\ntypedef _EnumGenericParams_Dart = int Function(\n Pointer obj,\n Pointer phEnum,\n int tk,\n Pointer rGenericParams,\n int cMax,\n Pointer pcGenericParams);\n\ntypedef _GetGenericParamProps_Native = Int32 Function(\n Pointer obj,\n Uint32 gp,\n Pointer pulParamSeq,\n Pointer pdwParamFlags,\n Pointer ptOwner,\n Pointer reserved,\n Pointer wzname,\n Uint32 cchName,\n Pointer pchName);\ntypedef _GetGenericParamProps_Dart = int Function(\n Pointer obj,\n int gp,\n Pointer pulParamSeq,\n Pointer pdwParamFlags,\n Pointer ptOwner,\n Pointer reserved,\n Pointer wzname,\n int cchName,\n Pointer pchName);\n\ntypedef _GetMethodSpecProps_Native = Int32 Function(\n Pointer obj,\n Uint32 mi,\n Pointer tkParent,\n Pointer ppvSigBlob,\n Pointer pcbSigBlob);\ntypedef _GetMethodSpecProps_Dart = int Function(\n Pointer obj,\n int mi,\n Pointer tkParent,\n Pointer ppvSigBlob,\n Pointer pcbSigBlob);\n\ntypedef _EnumGenericParamConstraints_Native = Int32 Function(\n Pointer obj,\n Pointer phEnum,\n Uint32 tk,\n Pointer rGenericParamConstraints,\n Uint32 cMax,\n Pointer pcGenericParamConstraints);\ntypedef _EnumGenericParamConstraints_Dart = int Function(\n Pointer obj,\n Pointer phEnum,\n int tk,\n Pointer rGenericParamConstraints,\n int cMax,\n Pointer pcGenericParamConstraints);\n\ntypedef _GetGenericParamConstraintProps_Native = Int32 Function(\n Pointer obj,\n Uint32 gpc,\n Pointer ptGenericParam,\n Pointer ptkConstraintType);\ntypedef _GetGenericParamConstraintProps_Dart = int Function(Pointer obj,\n int gpc, Pointer ptGenericParam, Pointer ptkConstraintType);\n\ntypedef _GetPEKind_Native = Int32 Function(\n Pointer obj, Pointer pdwPEKind, Pointer pdwMAchine);\ntypedef _GetPEKind_Dart = int Function(\n Pointer obj, Pointer pdwPEKind, Pointer pdwMAchine);\n\ntypedef _GetVersionString_Native = Int32 Function(Pointer obj,\n Pointer pwzBuf, Uint32 ccBufSize, Pointer pccBufSize);\ntypedef _GetVersionString_Dart = int Function(Pointer obj,\n Pointer pwzBuf, int ccBufSize, Pointer pccBufSize);\n\ntypedef _EnumMethodSpecs_Native = Int32 Function(\n Pointer obj,\n Pointer phEnum,\n Uint32 tk,\n Pointer rMethodSpecs,\n Uint32 cMax,\n Pointer pcMethodSpecs);\ntypedef _EnumMethodSpecs_Dart = int Function(\n Pointer obj,\n Pointer phEnum,\n int tk,\n Pointer rMethodSpecs,\n int cMax,\n Pointer pcMethodSpecs);\n\n\/\/\/ {@category Interface}\n\/\/\/ {@category com}\nclass IMetaDataImport2 extends IMetaDataImport {\n \/\/ vtable begins at 65, ends at 72\n\n IMetaDataImport2(Pointer ptr) : super(ptr);\n\n int EnumGenericParams(\n Pointer phEnum,\n int tk,\n Pointer rGenericParams,\n int cMax,\n Pointer pcGenericParams) =>\n Pointer>.fromAddress(\n ptr.ref.vtable.elementAt(65).value)\n .asFunction<_EnumGenericParams_Dart>()(\n ptr.ref.lpVtbl, phEnum, tk, rGenericParams, cMax, pcGenericParams);\n\n int GetGenericParamProps(\n int gp,\n Pointer pulParamSeq,\n Pointer pdwParamFlags,\n Pointer ptOwner,\n Pointer reserved,\n Pointer wzname,\n int cchName,\n Pointer pchName) =>\n Pointer>.fromAddress(\n ptr.ref.vtable.elementAt(66).value)\n .asFunction<_GetGenericParamProps_Dart>()(\n ptr.ref.lpVtbl,\n gp,\n pulParamSeq,\n pdwParamFlags,\n ptOwner,\n reserved,\n wzname,\n cchName,\n pchName);\n\n int GetMethodSpecProps(int mi, Pointer tkParent,\n Pointer ppvSigBlob, Pointer pcbSigBlob) =>\n Pointer>.fromAddress(\n ptr.ref.vtable.elementAt(67).value)\n .asFunction<_GetMethodSpecProps_Dart>()(\n ptr.ref.lpVtbl, mi, tkParent, ppvSigBlob, pcbSigBlob);\n\n int EnumGenericParamConstraints(\n Pointer phEnum,\n int tk,\n Pointer rGenericParamConstraints,\n int cMax,\n Pointer pcGenericParamConstraints) =>\n Pointer>.fromAddress(\n ptr.ref.vtable.elementAt(68).value)\n .asFunction<_EnumGenericParamConstraints_Dart>()(\n ptr.ref.lpVtbl,\n phEnum,\n tk,\n rGenericParamConstraints,\n cMax,\n pcGenericParamConstraints);\n\n int GetGenericParamConstraintProps(int gpc, Pointer ptGenericParam,\n Pointer ptkConstraintType) =>\n Pointer<\n NativeFunction<\n _GetGenericParamConstraintProps_Native>>.fromAddress(\n ptr.ref.vtable.elementAt(69).value)\n .asFunction<_GetGenericParamConstraintProps_Dart>()(\n ptr.ref.lpVtbl, gpc, ptGenericParam, ptkConstraintType);\n\n int GetPEKind(Pointer pdwPEKind, Pointer pdwMAchine) =>\n Pointer>.fromAddress(\n ptr.ref.vtable.elementAt(70).value)\n .asFunction<_GetPEKind_Dart>()(ptr.ref.lpVtbl, pdwPEKind, pdwMAchine);\n\n int GetVersionString(\n Pointer pwzBuf, int ccBufSize, Pointer pccBufSize) =>\n Pointer>.fromAddress(\n ptr.ref.vtable.elementAt(71).value)\n .asFunction<_GetVersionString_Dart>()(\n ptr.ref.lpVtbl, pwzBuf, ccBufSize, pccBufSize);\n\n int EnumMethodSpecs(\n Pointer phEnum,\n int tk,\n Pointer rMethodSpecs,\n int cMax,\n Pointer pcMethodSpecs) =>\n Pointer>.fromAddress(\n ptr.ref.vtable.elementAt(72).value)\n .asFunction<_EnumMethodSpecs_Dart>()(\n ptr.ref.lpVtbl, phEnum, tk, rMethodSpecs, cMax, pcMethodSpecs);\n}\n","avg_line_length":33.3518518519,"max_line_length":80,"alphanum_fraction":0.6829539145} {"size":13624,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/*\n\n--- Day 14: Space Stoichiometry ---\n\nAs you approach the rings of Saturn, your ship's low fuel indicator turns on.\nThere isn't any fuel here, but the rings have plenty of raw material. Perhaps\nyour ship's Inter-Stellar Refinery Union brand nanofactory can turn these raw\nmaterials into fuel.\n\nYou ask the nanofactory to produce a list of the reactions it can perform that\nare relevant to this process (your puzzle input). Every reaction turns some\nquantities of specific input chemicals into some quantity of an output chemical.\nAlmost every chemical is produced by exactly one reaction; the only exception,\nORE, is the raw material input to the entire process and is not produced by a\nreaction.\n\nYou just need to know how much ORE you'll need to collect before you can produce\none unit of FUEL.\n\nEach reaction gives specific quantities for its inputs and output; reactions\ncannot be partially run, so only whole integer multiples of these quantities can\nbe used. (It's okay to have leftover chemicals when you're done, though.) For\nexample, the reaction 1 A, 2 B, 3 C => 2 D means that exactly 2 units of\nchemical D can be produced by consuming exactly 1 A, 2 B and 3 C. You can run\nthe full reaction as many times as necessary; for example, you could produce 10\nD by consuming 5 A, 10 B, and 15 C.\n\nSuppose your nanofactory produces the following list of reactions:\n\n10 ORE => 10 A\n1 ORE => 1 B\n7 A, 1 B => 1 C\n7 A, 1 C => 1 D\n7 A, 1 D => 1 E\n7 A, 1 E => 1 FUEL\n\nThe first two reactions use only ORE as inputs; they indicate that you can\nproduce as much of chemical A as you want (in increments of 10 units, each 10\ncosting 10 ORE) and as much of chemical B as you want (each costing 1 ORE). To\nproduce 1 FUEL, a total of 31 ORE is required: 1 ORE to produce 1 B, then 30\nmore ORE to produce the 7 + 7 + 7 + 7 = 28 A (with 2 extra A wasted) required in\nthe reactions to convert the B into C, C into D, D into E, and finally E into\nFUEL. (30 A is produced because its reaction requires that it is created in\nincrements of 10.)\n\nOr, suppose you have the following list of reactions:\n\n9 ORE => 2 A\n8 ORE => 3 B\n7 ORE => 5 C\n3 A, 4 B => 1 AB\n5 B, 7 C => 1 BC\n4 C, 1 A => 1 CA\n2 AB, 3 BC, 4 CA => 1 FUEL\n\nThe above list of reactions requires 165 ORE to produce 1 FUEL:\n\nConsume 45 ORE to produce 10 A.\nConsume 64 ORE to produce 24 B.\nConsume 56 ORE to produce 40 C.\nConsume 6 A, 8 B to produce 2 AB.\nConsume 15 B, 21 C to produce 3 BC.\nConsume 16 C, 4 A to produce 4 CA.\nConsume 2 AB, 3 BC, 4 CA to produce 1 FUEL.\n\nHere are some larger examples:\n\n13312 ORE for 1 FUEL:\n\n157 ORE => 5 NZVS\n165 ORE => 6 DCFZ\n44 XJWVT, 5 KHKGT, 1 QDVJ, 29 NZVS, 9 GPVTF, 48 HKGWZ => 1 FUEL\n12 HKGWZ, 1 GPVTF, 8 PSHF => 9 QDVJ\n179 ORE => 7 PSHF\n177 ORE => 5 HKGWZ\n7 DCFZ, 7 PSHF => 2 XJWVT\n165 ORE => 2 GPVTF\n3 DCFZ, 7 NZVS, 5 HKGWZ, 10 PSHF => 8 KHKGT\n\n180697 ORE for 1 FUEL:\n\n2 VPVL, 7 FWMGM, 2 CXFTF, 11 MNCFX => 1 STKFG\n17 NVRVD, 3 JNWZP => 8 VPVL\n53 STKFG, 6 MNCFX, 46 VJHF, 81 HVMC, 68 CXFTF, 25 GNMV => 1 FUEL\n22 VJHF, 37 MNCFX => 5 FWMGM\n139 ORE => 4 NVRVD\n144 ORE => 7 JNWZP\n5 MNCFX, 7 RFSQX, 2 FWMGM, 2 VPVL, 19 CXFTF => 3 HVMC\n5 VJHF, 7 MNCFX, 9 VPVL, 37 CXFTF => 6 GNMV\n145 ORE => 6 MNCFX\n1 NVRVD => 8 CXFTF\n1 VJHF, 6 MNCFX => 4 RFSQX\n176 ORE => 6 VJHF\n\n2210736 ORE for 1 FUEL:\n\n171 ORE => 8 CNZTR\n7 ZLQW, 3 BMBT, 9 XCVML, 26 XMNCP, 1 WPTQ, 2 MZWV, 1 RJRHP => 4 PLWSL\n114 ORE => 4 BHXH\n14 VRPVC => 6 BMBT\n6 BHXH, 18 KTJDG, 12 WPTQ, 7 PLWSL, 31 FHTLT, 37 ZDVW => 1 FUEL\n6 WPTQ, 2 BMBT, 8 ZLQW, 18 KTJDG, 1 XMNCP, 6 MZWV, 1 RJRHP => 6 FHTLT\n15 XDBXC, 2 LTCX, 1 VRPVC => 6 ZLQW\n13 WPTQ, 10 LTCX, 3 RJRHP, 14 XMNCP, 2 MZWV, 1 ZLQW => 1 ZDVW\n5 BMBT => 4 WPTQ\n189 ORE => 9 KTJDG\n1 MZWV, 17 XDBXC, 3 XCVML => 2 XMNCP\n12 VRPVC, 27 CNZTR => 2 XDBXC\n15 KTJDG, 12 BHXH => 5 XCVML\n3 BHXH, 2 VRPVC => 7 MZWV\n121 ORE => 7 VRPVC\n7 XCVML => 6 RJRHP\n5 BHXH, 4 VRPVC => 5 LTCX\n\nGiven the list of reactions in your puzzle input, what is the minimum amount of\nORE required to produce exactly 1 FUEL?\n\n--- Part Two --- \n\nAfter collecting ORE for a while, you check your cargo hold: 1\ntrillion (1000000000000) units of ORE.\n\nWith that much ore, given the examples above:\n\nThe 13312 ORE-per-FUEL example could produce 82892753 FUEL.\nThe 180697 ORE-per-FUEL example could produce 5586022 FUEL.\nThe 2210736 ORE-per-FUEL example could produce 460664 FUEL.\nGiven 1 trillion ORE, what is the maximum amount of FUEL you can produce?\n*\/\n\nimport 'package:test\/test.dart';\n\nclass Unit {\n String name;\n Unit(this.name);\n @override\n String toString() => name;\n\n @override\n bool operator ==(dynamic other) => other is Unit && other.name == name;\n\n @override\n int get hashCode => name.hashCode;\n}\n\nclass Amount {\n final int amount;\n final Unit unit;\n Amount(this.amount, this.unit);\n\n @override\n String toString() => '$amount $unit';\n\n Amount operator +(Amount other) {\n if (other.unit != unit) {\n throw ArgumentError('canot add ${other.unit}to $unit');\n }\n return Amount(amount + other.amount, unit);\n }\n\n Amount operator -(Amount other) => this + (-other);\n Amount operator -() => Amount(-amount, unit);\n\n Amount operator *(int num) {\n return Amount(amount * num, unit);\n }\n\n static Amount parse(String input) {\n var parts = input.trim().split(' ');\n if (parts.length != 2) {\n throw ArgumentError.value(input, 'input', 'Must be ');\n }\n return Amount(int.parse(parts.first), Unit(parts.last));\n }\n\n static Amount zero(Unit unit) => Amount(0, unit);\n}\n\nclass Reaction {\n List input;\n Amount output;\n\n Reaction(this.input, this.output);\n\n @override\n String toString() => '${input.join(', ')} => $output';\n\n static Reaction parse(String line) {\n var parts = line.split('=>');\n if (parts.length != 2) {\n throw ArgumentError.value(line, 'line', 'Unexpected reaction format');\n }\n var input =\n parts.first.split(',').map((part) => Amount.parse(part)).toList();\n var output = Amount.parse(parts.last);\n return Reaction(input, output);\n }\n}\n\nclass Reactions {\n Map reactions;\n\n Reactions(List reactions)\n : reactions = {for (var r in reactions) r.output.unit: r};\n\n Reaction operator [](Unit output) => reactions[output];\n\n static Reactions parse(String input) => Reactions(\n input.trim().split('\\n').map((line) => Reaction.parse(line)).toList());\n}\n\n\/\/\/ Tracks amounts. Amount can be negative.\nclass Inventory {\n var amounts = {};\n\n Inventory clone() => Inventory()..amounts = Map.of(amounts);\n\n Amount operator [](Unit unit) => amounts[unit] ?? Amount.zero(unit);\n void add(Amount amount) => amounts[amount.unit] = this[amount.unit] + amount;\n\n void remove(Amount amount) => add(-amount);\n\n void runReaction(Reaction reaction, [int count = 1]) {\n for (var input in reaction.input) {\n remove(input * count);\n }\n add(reaction.output * count);\n }\n\n void produceFuel(Reactions reactions, [int count = 1]) {\n runReaction(reactions[fuel], count);\n compensate(reactions);\n }\n\n void compensate(Reactions reactions) {\n while (true) {\n var missingEntry = amounts.entries.firstWhere(\n (entry) => entry.key != ore && entry.value.amount < 0,\n orElse: () => null);\n if (missingEntry == null) {\n break;\n }\n var reaction = reactions[missingEntry.key];\n var count = (-missingEntry.value.amount + reaction.output.amount - 1) ~\/\n reaction.output.amount;\n runReaction(reaction, count);\n }\n }\n}\n\nint task1(String input) {\n var reactions = Reactions.parse(input);\n var inventory = Inventory();\n inventory.produceFuel(reactions);\n return -inventory.amounts[ore].amount;\n}\n\nvoid check(String spec) {\n var lines = spec.trim().split('\\n');\n var target = int.parse(lines.first.split(' ').first);\n expect(task1(lines.sublist(2).join('\\n')), target);\n}\n\nint task2(String input) {\n var reactions = Reactions.parse(input);\n var inventory = Inventory();\n var budget = 1000000000000;\n inventory.produceFuel(reactions);\n var estimate = budget ~\/ -inventory[ore].amount;\n inventory.produceFuel(reactions, estimate - 1);\n\n bool inBudget(Inventory inv) => inv[ore].amount + budget > 0;\n var step = estimate;\n var result = estimate;\n var backup = inventory.clone();\n var backupResult = result;\n while (step > 0) {\n inventory.produceFuel(reactions, step);\n\n result += step;\n if (!inBudget(inventory)) {\n \/\/ roll back and decrease step.\n result = backupResult;\n inventory = backup.clone();\n step ~\/= 2;\n } else {\n backup = inventory.clone();\n backupResult = result;\n }\n }\n\n return result;\n}\n\nfinal ore = Unit('ORE');\nfinal fuel = Unit('FUEL');\n\nvoid main() {\n group('part1', () {\n test('sample1', () {\n expect(task1('''9 ORE => 2 A\n8 ORE => 3 B\n7 ORE => 5 C\n3 A, 4 B => 1 AB\n5 B, 7 C => 1 BC\n4 C, 1 A => 1 CA\n2 AB, 3 BC, 4 CA => 1 FUEL\n'''), 165);\n });\n test('sample2', () {\n check('''13312 ORE for 1 FUEL:\n\n157 ORE => 5 NZVS\n165 ORE => 6 DCFZ\n44 XJWVT, 5 KHKGT, 1 QDVJ, 29 NZVS, 9 GPVTF, 48 HKGWZ => 1 FUEL\n12 HKGWZ, 1 GPVTF, 8 PSHF => 9 QDVJ\n179 ORE => 7 PSHF\n177 ORE => 5 HKGWZ\n7 DCFZ, 7 PSHF => 2 XJWVT\n165 ORE => 2 GPVTF\n3 DCFZ, 7 NZVS, 5 HKGWZ, 10 PSHF => 8 KHKGT\n''');\n });\n test('sample3', () {\n check('''180697 ORE for 1 FUEL:\n\n2 VPVL, 7 FWMGM, 2 CXFTF, 11 MNCFX => 1 STKFG\n17 NVRVD, 3 JNWZP => 8 VPVL\n53 STKFG, 6 MNCFX, 46 VJHF, 81 HVMC, 68 CXFTF, 25 GNMV => 1 FUEL\n22 VJHF, 37 MNCFX => 5 FWMGM\n139 ORE => 4 NVRVD\n144 ORE => 7 JNWZP\n5 MNCFX, 7 RFSQX, 2 FWMGM, 2 VPVL, 19 CXFTF => 3 HVMC\n5 VJHF, 7 MNCFX, 9 VPVL, 37 CXFTF => 6 GNMV\n145 ORE => 6 MNCFX\n1 NVRVD => 8 CXFTF\n1 VJHF, 6 MNCFX => 4 RFSQX\n176 ORE => 6 VJHF\n''');\n });\n test('sample4', () {\n check('''2210736 ORE for 1 FUEL:\n\n171 ORE => 8 CNZTR\n7 ZLQW, 3 BMBT, 9 XCVML, 26 XMNCP, 1 WPTQ, 2 MZWV, 1 RJRHP => 4 PLWSL\n114 ORE => 4 BHXH\n14 VRPVC => 6 BMBT\n6 BHXH, 18 KTJDG, 12 WPTQ, 7 PLWSL, 31 FHTLT, 37 ZDVW => 1 FUEL\n6 WPTQ, 2 BMBT, 8 ZLQW, 18 KTJDG, 1 XMNCP, 6 MZWV, 1 RJRHP => 6 FHTLT\n15 XDBXC, 2 LTCX, 1 VRPVC => 6 ZLQW\n13 WPTQ, 10 LTCX, 3 RJRHP, 14 XMNCP, 2 MZWV, 1 ZLQW => 1 ZDVW\n5 BMBT => 4 WPTQ\n189 ORE => 9 KTJDG\n1 MZWV, 17 XDBXC, 3 XCVML => 2 XMNCP\n12 VRPVC, 27 CNZTR => 2 XDBXC\n15 KTJDG, 12 BHXH => 5 XCVML\n3 BHXH, 2 VRPVC => 7 MZWV\n121 ORE => 7 VRPVC\n7 XCVML => 6 RJRHP\n5 BHXH, 4 VRPVC => 5 LTCX\n''');\n });\n test('task', () {\n print(task1(input));\n });\n });\n group('part2', () {\n test('sample2', () {\n expect(task2('''157 ORE => 5 NZVS\n165 ORE => 6 DCFZ\n44 XJWVT, 5 KHKGT, 1 QDVJ, 29 NZVS, 9 GPVTF, 48 HKGWZ => 1 FUEL\n12 HKGWZ, 1 GPVTF, 8 PSHF => 9 QDVJ\n179 ORE => 7 PSHF\n177 ORE => 5 HKGWZ\n7 DCFZ, 7 PSHF => 2 XJWVT\n165 ORE => 2 GPVTF\n3 DCFZ, 7 NZVS, 5 HKGWZ, 10 PSHF => 8 KHKGT\n'''), 82892753);\n });\n test('sample3', () {\n expect(task2('''2 VPVL, 7 FWMGM, 2 CXFTF, 11 MNCFX => 1 STKFG\n17 NVRVD, 3 JNWZP => 8 VPVL\n53 STKFG, 6 MNCFX, 46 VJHF, 81 HVMC, 68 CXFTF, 25 GNMV => 1 FUEL\n22 VJHF, 37 MNCFX => 5 FWMGM\n139 ORE => 4 NVRVD\n144 ORE => 7 JNWZP\n5 MNCFX, 7 RFSQX, 2 FWMGM, 2 VPVL, 19 CXFTF => 3 HVMC\n5 VJHF, 7 MNCFX, 9 VPVL, 37 CXFTF => 6 GNMV\n145 ORE => 6 MNCFX\n1 NVRVD => 8 CXFTF\n1 VJHF, 6 MNCFX => 4 RFSQX\n176 ORE => 6 VJHF\n'''), 5586022);\n });\n test('sample4', () {\n expect(task2('''\n171 ORE => 8 CNZTR\n7 ZLQW, 3 BMBT, 9 XCVML, 26 XMNCP, 1 WPTQ, 2 MZWV, 1 RJRHP => 4 PLWSL\n114 ORE => 4 BHXH\n14 VRPVC => 6 BMBT\n6 BHXH, 18 KTJDG, 12 WPTQ, 7 PLWSL, 31 FHTLT, 37 ZDVW => 1 FUEL\n6 WPTQ, 2 BMBT, 8 ZLQW, 18 KTJDG, 1 XMNCP, 6 MZWV, 1 RJRHP => 6 FHTLT\n15 XDBXC, 2 LTCX, 1 VRPVC => 6 ZLQW\n13 WPTQ, 10 LTCX, 3 RJRHP, 14 XMNCP, 2 MZWV, 1 ZLQW => 1 ZDVW\n5 BMBT => 4 WPTQ\n189 ORE => 9 KTJDG\n1 MZWV, 17 XDBXC, 3 XCVML => 2 XMNCP\n12 VRPVC, 27 CNZTR => 2 XDBXC\n15 KTJDG, 12 BHXH => 5 XCVML\n3 BHXH, 2 VRPVC => 7 MZWV\n121 ORE => 7 VRPVC\n7 XCVML => 6 RJRHP\n5 BHXH, 4 VRPVC => 5 LTCX\n'''), 460664);\n });\n test('task', () {\n print(task2(input));\n });\n });\n}\n\nvar input = '''\n2 LFPRM, 4 GPNQ => 2 VGZVD\n1 KXFHM, 14 SJLP => 8 MGRTM\n2 HBXVT, 3 HNHC, 5 BDLV => 1 DKTW\n2 MGRTM, 8 RVTB => 4 DFMW\n2 SJLP => 9 PXTS\n1 NXBG => 6 FXBXZ\n32 LPSQ => 9 GSDXD\n13 LZGTR => 4 ZRMJ\n1 FTPQ, 16 CPCS => 5 HNHC\n2 THQH, 2 NDJG, 5 MSKT => 4 LRZV\n2 BDLV, 9 HBXVT, 21 NXBG => 7 PLRK\n16 LNSKQ, 41 KXFHM, 1 DKTW, 1 NCPSZ, 3 ZCSB, 11 MGRTM, 19 WNJWP, 11 KRBG => 1 FUEL\n5 FTPQ, 1 HBXVT => 4 BDLV\n15 LSDX, 1 GFJW, 1 QDHJT => 4 NKHQV\n9 CZHTP, 1 FRPTK => 6 SNBS\n17 LFLVS, 2 WCFT => 8 KGJQ\n6 CMHLP => 1 SJLP\n144 ORE => 3 KQKXZ\n3 GFJW, 1 RVTB, 1 GPNQ => 2 NXBG\n4 BDLV => 5 CMHLP\n2 LSDX => 1 LZGTR\n156 ORE => 3 NDJG\n136 ORE => 8 MSKT\n4 BDLV, 1 NKHQV, 1 RVTB => 7 LNSKQ\n1 LRZV, 3 WCFT => 2 HBXVT\n5 KGJQ, 1 SWBSN => 7 QHFX\n2 DQHBG => 4 LPSQ\n6 GSDXD => 3 LSDX\n11 RWLD, 3 BNKVZ, 4 PXTS, 3 XTRQC, 5 LSDX, 5 LMHL, 36 MGRTM => 4 ZCSB\n8 CPCS => 2 FRPTK\n5 NDJG => 3 WCFT\n1 GDQG, 1 QHFX => 4 KXFHM\n160 ORE => 3 THQH\n20 GFJW, 2 DQHBG => 6 RVTB\n2 FXBXZ, 1 WNJWP, 1 VGZVD => 5 RWLD\n3 DQHBG => 7 SWBSN\n7 QHFX => 8 CPCS\n14 HBXVT => 3 VCDW\n5 FRPTK => 7 NGDX\n1 HWFQ => 4 LFLVS\n2 CPCS => 6 ZTKSW\n9 KGJQ, 8 ZTKSW, 13 BDLV => 6 GDQG\n13 LMHL, 1 LZGTR, 18 BNKVZ, 11 VCDW, 9 DFMW, 11 FTPQ, 3 RWLD => 4 KRBG\n1 XRCH => 7 GPNQ\n3 WCFT => 9 DQHBG\n1 FTPQ => 8 CZHTP\n1 PBMR, 2 ZTKSW => 2 BNKVZ\n2 PLRK, 3 CPCS => 8 ZSGBG\n3 NGDX, 3 XRCH => 6 XTRQC\n6 ZTKSW, 11 HNHC, 22 SNBS => 9 WNJWP\n5 KQKXZ => 8 HWFQ\n23 WCFT => 7 PBMR\n1 LRZV, 1 QDHJT => 2 GFJW\n1 ZSGBG, 5 CGTHV, 9 ZRMJ => 3 LMHL\n1 DQHBG => 9 XRCH\n1 GDQG, 17 RWLD, 2 KGJQ, 8 VCDW, 2 BNKVZ, 2 WNJWP, 1 VGZVD => 3 NCPSZ\n19 SJLP, 3 ZTKSW, 1 CZHTP => 4 LFPRM\n14 SNBS => 8 CGTHV\n3 DQHBG, 4 WCFT => 1 FTPQ\n3 MSKT, 3 NDJG => 5 QDHJT\n''';\n","avg_line_length":28.1487603306,"max_line_length":82,"alphanum_fraction":0.6465795655} {"size":2148,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'dart:async';\n\nimport 'package:network_info_plus_platform_interface\/network_info_plus_platform_interface.dart';\nimport 'package:meta\/meta.dart';\n\nimport 'network_manager.dart';\n\n\/\/ Used internally\n\/\/ ignore_for_file: public_member_api_docs\n\ntypedef _DeviceGetter = Future Function(NMDevice device);\ntypedef _ConnectionGetter = Future Function(NMConnection connection);\n\n@visibleForTesting\ntypedef NetworkManagerFactory = NetworkManager Function();\n\n\/\/\/ The Linux implementation of NetworkInfoPlatform.\nclass NetworkInfoLinux extends NetworkInfoPlatform {\n \/\/\/ Obtains the wifi name (SSID) of the connected network\n @override\n Future getWifiName() {\n return _getConnectionValue((connection) => connection.getId());\n }\n\n \/\/\/ Obtains the IP address of the connected wifi network\n @override\n Future getWifiIP() {\n return _getDeviceValue((device) => device.getIp4());\n }\n\n \/\/\/ Obtains the wifi BSSID of the connected network.\n @override\n Future getWifiBSSID() {\n return _getDeviceValue((device) {\n return device\n .asWirelessDevice()\n .then((wireless) => wireless?.getHwAddress());\n });\n }\n\n Future _getDeviceValue(_DeviceGetter getter) {\n return _getConnectionValue((connection) {\n return connection.createDevice().then((device) {\n return device != null ? getter(device) : null;\n });\n });\n }\n\n Future _getConnectionValue(_ConnectionGetter getter) {\n return _ref().createConnection().then((connection) {\n return connection != null ? getter(connection) : null;\n }).whenComplete(_deref);\n }\n\n int _refCount = 0;\n NetworkManager _manager;\n\n NetworkManager _ref() {\n _manager ??= createManager();\n ++_refCount;\n return _manager;\n }\n\n void _deref() {\n \/\/ schedules an asynchronous disposal when the last reference is removed\n if (--_refCount == 0) {\n scheduleMicrotask(() {\n if (_refCount == 0) {\n _manager.dispose();\n _manager = null;\n }\n });\n }\n }\n\n @visibleForTesting\n NetworkManagerFactory createManager = () => NetworkManager.system();\n}\n","avg_line_length":27.1898734177,"max_line_length":96,"alphanum_fraction":0.6918063315} {"size":4517,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nimport 'dart:io';\n\nimport 'package:args\/args.dart';\nimport 'package:args\/command_runner.dart';\nimport 'package:build_runner_core\/build_runner_core.dart';\nimport 'package:logging\/logging.dart';\n\nimport 'options.dart';\nimport 'runner.dart';\n\nfinal lineLength = stdout.hasTerminal ? stdout.terminalColumns : 80;\n\nabstract class BuildRunnerCommand extends Command {\n Logger get logger => Logger(name);\n\n List get builderApplications =>\n (runner as BuildCommandRunner).builderApplications;\n\n PackageGraph get packageGraph => (runner as BuildCommandRunner).packageGraph;\n\n BuildRunnerCommand({bool symlinksDefault}) {\n _addBaseFlags(symlinksDefault ?? false);\n }\n\n @override\n final argParser = ArgParser(usageLineLength: lineLength);\n\n void _addBaseFlags(bool symlinksDefault) {\n argParser\n ..addFlag(deleteFilesByDefaultOption,\n help:\n 'By default, the user will be prompted to delete any files which '\n 'already exist but were not known to be generated by this '\n 'specific build script.\\n\\n'\n 'Enabling this option skips the prompt and deletes the files. '\n 'This should typically be used in continues integration servers '\n 'and tests, but not otherwise.',\n negatable: false,\n defaultsTo: false)\n ..addFlag(lowResourcesModeOption,\n help: 'Reduce the amount of memory consumed by the build process. '\n 'This will slow down builds but allow them to progress in '\n 'resource constrained environments.',\n negatable: false,\n defaultsTo: false)\n ..addOption(configOption,\n help: 'Read `build..yaml` instead of the default `build.yaml`',\n abbr: 'c')\n ..addFlag('fail-on-severe',\n help: 'Deprecated argument - always enabled',\n negatable: true,\n defaultsTo: true,\n hide: true)\n ..addFlag(trackPerformanceOption,\n help: r'Enables performance tracking and the \/$perf page.',\n negatable: true,\n defaultsTo: false)\n ..addOption(logPerformanceOption,\n help: 'A directory to write performance logs to, must be in the '\n 'current package. Implies `--track-performance`.')\n ..addFlag(skipBuildScriptCheckOption,\n help: r'Skip validation for the digests of files imported by the '\n 'build script.',\n hide: true,\n defaultsTo: false)\n ..addMultiOption(outputOption,\n help: 'A directory to copy the fully built package to. Or a mapping '\n 'from a top-level directory in the package to the directory to '\n 'write a filtered build output to. For example \"web:deploy\".',\n abbr: 'o')\n ..addFlag(verboseOption,\n abbr: 'v',\n defaultsTo: false,\n negatable: false,\n help: 'Enables verbose logging.')\n ..addFlag(releaseOption,\n abbr: 'r',\n defaultsTo: false,\n negatable: true,\n help: 'Build with release mode defaults for builders.')\n ..addMultiOption(defineOption,\n splitCommas: false,\n help: 'Sets the global `options` config for a builder by key.')\n ..addFlag(symlinkOption,\n defaultsTo: symlinksDefault,\n negatable: true,\n help: 'Symlink files in the output directories, instead of copying.')\n ..addMultiOption(buildFilterOption,\n help: 'An explicit filter of files to build. Relative paths and '\n '`package:` uris are supported, including glob syntax for paths '\n 'portions (but not package names).\\n\\n'\n 'If multiple filters are applied then outputs matching any filter '\n 'will be built (they do not need to match all filters).')\n ..addMultiOption(enableExperimentOption,\n help: 'A list of dart language experiments to enable.');\n }\n\n \/\/\/ Must be called inside [run] so that [argResults] is non-null.\n \/\/\/\n \/\/\/ You may override this to return more specific options if desired, but they\n \/\/\/ must extend [SharedOptions].\n SharedOptions readOptions() {\n return SharedOptions.fromParsedArgs(\n argResults, argResults.rest, packageGraph.root.name, this);\n }\n}\n","avg_line_length":40.6936936937,"max_line_length":81,"alphanum_fraction":0.6468895284} {"size":1025,"ext":"dart","lang":"Dart","max_stars_count":2.0,"content":"import 'dart:convert';\n\nimport 'package:hive\/hive.dart';\npart 'products.g.dart';\n\nList productFromJson(String str) =>\n List.from(json.decode(str).map((x) => Product.fromJson(x)));\n\nString productToJson(List data) =>\n json.encode(List.from(data.map((x) => x.toJson())));\n\n@HiveType(typeId: 2)\nclass Product {\n Product({\n required this.id,\n required this.name,\n required this.description,\n required this.image,\n required this.price,\n });\n\n @HiveField(0)\n String id;\n @HiveField(1)\n String name;\n @HiveField(2)\n String description;\n @HiveField(3)\n String image;\n @HiveField(4)\n double price;\n\n factory Product.fromJson(Map json) => Product(\n id: json[\"_id\"],\n name: json[\"name\"],\n description: json[\"description\"],\n image: json[\"image\"],\n price: json[\"price\"].toDouble(),\n );\n\n Map toJson() => {\n \"_id\": id,\n \"name\": name,\n \"description\": description,\n \"image\": image,\n \"price\": price\n };\n}\n","avg_line_length":20.9183673469,"max_line_length":73,"alphanum_fraction":0.6370731707} {"size":994,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"library eggnstone_flutter;\n\nexport 'src\/services\/analytics\/AnalyticsMixin.dart';\nexport 'src\/services\/analytics\/AnalyticsNavigatorObserver.dart';\nexport 'src\/services\/analytics\/IAnalyticsService.dart';\nexport 'src\/services\/crashlytics\/CrashlyticsMixin.dart';\nexport 'src\/services\/crashlytics\/ICrashlyticsService.dart';\nexport 'src\/services\/shared_preferences\/SharedPreferencesMixin.dart';\nexport 'src\/services\/shared_preferences\/SharedPreferencesService.dart';\nexport 'src\/tools\/LogTools.dart';\nexport 'src\/tools\/StackTraceTools.dart';\nexport 'src\/tools\/StringTools.dart';\nexport 'src\/tools\/UrlLauncherTools.dart';\nexport 'src\/tools\/platform_tools\/ClipboardNonWebTools.dart' if (dart.library.html) 'src\/tools\/platform_tools\/ClipboardWebTools.dart';\nexport 'src\/tools\/platform_tools\/PlatformNonWebTools.dart' if (dart.library.html) 'src\/tools\/platform_tools\/PlatformWebTools.dart';\nexport 'src\/widgets\/ActionLink.dart';\nexport 'src\/widgets\/BusyDialog.dart';\nexport 'src\/widgets\/HyperLink.dart';\n","avg_line_length":52.3157894737,"max_line_length":133,"alphanum_fraction":0.8319919517} {"size":3988,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"part of 'likes_timeline_bloc.dart';\n\nabstract class LikesTimelineEvent extends Equatable {\n const LikesTimelineEvent();\n\n Stream applyAsync({\n LikesTimelineState currentState,\n LikesTimelineBloc bloc,\n });\n}\n\n\/\/\/ Requests the likes timeline tweets for the [LikesTimelineBloc.screenName].\nclass RequestLikesTimeline extends LikesTimelineEvent with HarpyLogger {\n const RequestLikesTimeline();\n\n @override\n List get props => [];\n\n @override\n Stream applyAsync({\n LikesTimelineState currentState,\n LikesTimelineBloc bloc,\n }) async* {\n log.fine('requesting likes timeline');\n\n yield const LikesTimelineInitialLoading();\n\n String maxId;\n\n final List tweets = await bloc.tweetService\n .listFavorites(\n screenName: bloc.screenName,\n count: 200,\n )\n .then((List tweets) {\n if (tweets != null && tweets.isNotEmpty) {\n maxId = tweets.last.idStr;\n }\n return tweets;\n })\n .then(handleTweets)\n .catchError(twitterApiErrorHandler);\n\n if (tweets != null) {\n log.fine('found ${tweets.length} initial tweets');\n\n if (tweets.isNotEmpty) {\n yield LikesTimelineResult(\n tweets: tweets,\n maxId: maxId,\n );\n } else {\n yield const LikesTimelineNoResult();\n }\n } else {\n yield const LikesTimelineFailure();\n }\n }\n}\n\n\/\/\/ An event to request older likes timeline tweets.\n\/\/\/\n\/\/\/ This is used when the end of the likes timeline has been reached and the\n\/\/\/ user wants to load the older (previous) tweets.\n\/\/\/\n\/\/\/ Only the last 800 tweets in a likes timeline can be requested.\nclass RequestOlderLikesTimeline extends LikesTimelineEvent with HarpyLogger {\n const RequestOlderLikesTimeline();\n\n @override\n List get props => [];\n\n String _findMaxId(LikesTimelineResult state) {\n final int lastId = int.tryParse(state.maxId ?? '');\n\n if (lastId != null) {\n return '${lastId - 1}';\n } else {\n return null;\n }\n }\n\n @override\n Stream applyAsync({\n LikesTimelineState currentState,\n LikesTimelineBloc bloc,\n }) async* {\n if (bloc.lock()) {\n bloc.requestOlderCompleter.complete();\n bloc.requestOlderCompleter = Completer();\n return;\n }\n\n if (currentState is LikesTimelineResult) {\n final String maxId = _findMaxId(currentState);\n\n if (maxId == null) {\n log.info('tried to request older but max id was null');\n return;\n }\n\n log.fine('requesting older likes timeline tweets');\n\n yield LikesTimelineLoadingOlder(oldResult: currentState);\n\n String newMaxId;\n bool canRequestOlder = false;\n\n final List tweets = await bloc.tweetService\n .listFavorites(\n screenName: bloc.screenName,\n count: 200,\n maxId: maxId,\n )\n .then((List tweets) {\n if (tweets != null && tweets.isNotEmpty) {\n newMaxId = tweets.last.idStr;\n canRequestOlder = true;\n } else {\n canRequestOlder = false;\n }\n return tweets;\n })\n .then(handleTweets)\n .catchError(twitterApiErrorHandler);\n\n if (tweets != null) {\n log.fine('found ${tweets.length} older tweets');\n log.finer('can request older: $canRequestOlder');\n\n yield LikesTimelineResult(\n tweets: currentState.tweets.followedBy(tweets).toList(),\n maxId: newMaxId,\n canRequestOlder: canRequestOlder,\n );\n } else {\n \/\/ re-yield result state with previous tweets but new max id\n yield LikesTimelineResult(\n tweets: currentState.tweets,\n maxId: currentState.maxId,\n );\n }\n }\n\n bloc.requestOlderCompleter.complete();\n bloc.requestOlderCompleter = Completer();\n }\n}\n","avg_line_length":26.7651006711,"max_line_length":78,"alphanum_fraction":0.6228686058} {"size":34861,"ext":"dart","lang":"Dart","max_stars_count":21.0,"content":"\/\/ Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nimport 'package:analyzer\/dart\/ast\/ast.dart';\nimport 'package:analyzer\/dart\/ast\/token.dart';\nimport 'package:analyzer\/dart\/ast\/visitor.dart';\nimport 'package:analyzer\/dart\/element\/element.dart';\nimport 'package:analyzer\/dart\/element\/type.dart';\nimport 'package:analyzer\/src\/dart\/ast\/extensions.dart';\nimport 'package:analyzer\/src\/summary\/format.dart';\nimport 'package:analyzer\/src\/summary\/idl.dart';\nimport 'package:meta\/meta.dart';\n\nElement? declaredParameterElement(\n SimpleIdentifier node,\n Element? element,\n) {\n if (element == null || element.enclosingElement != null) {\n return element;\n }\n\n \/\/\/ When we instantiate the [FunctionType] of an executable, we use\n \/\/\/ synthetic [ParameterElement]s, disconnected from the rest of the\n \/\/\/ element model. But we want to index these parameter references\n \/\/\/ as references to declared parameters.\n ParameterElement? namedParameterElement(ExecutableElement? executable) {\n if (executable == null) {\n return null;\n }\n\n var parameterName = node.name;\n return executable.declaration.parameters.where((parameter) {\n return parameter.isNamed && parameter.name == parameterName;\n }).first;\n }\n\n var parent = node.parent;\n if (parent is Label && parent.label == node) {\n var namedExpression = parent.parent;\n if (namedExpression is NamedExpression && namedExpression.name == parent) {\n var argumentList = namedExpression.parent;\n if (argumentList is ArgumentList) {\n var invocation = argumentList.parent;\n if (invocation is InstanceCreationExpression) {\n var executable = invocation.constructorName.staticElement;\n return namedParameterElement(executable);\n } else if (invocation is MethodInvocation) {\n var executable = invocation.methodName.staticElement;\n if (executable is ExecutableElement) {\n return namedParameterElement(executable);\n }\n }\n }\n }\n }\n\n return element;\n}\n\n\/\/\/ Return the [CompilationUnitElement] that should be used for [element].\n\/\/\/ Throw [StateError] if the [element] is not linked into a unit.\nCompilationUnitElement getUnitElement(Element element) {\n for (Element? e = element; e != null; e = e.enclosingElement) {\n if (e is CompilationUnitElement) {\n return e;\n }\n if (e is LibraryElement) {\n return e.definingCompilationUnit;\n }\n }\n throw StateError('Element not contained in compilation unit: $element');\n}\n\n\/\/\/ Index the [unit] into a new [AnalysisDriverUnitIndexBuilder].\nAnalysisDriverUnitIndexBuilder indexUnit(CompilationUnit unit) {\n return _IndexAssembler().assemble(unit);\n}\n\nclass ElementNameComponents {\n final String? parameterName;\n final String? classMemberName;\n final String? unitMemberName;\n\n factory ElementNameComponents(Element element) {\n String? parameterName;\n if (element is ParameterElement) {\n parameterName = element.name;\n element = element.enclosingElement!;\n }\n\n String? classMemberName;\n if (element.enclosingElement is ClassElement ||\n element.enclosingElement is ExtensionElement) {\n classMemberName = element.name!;\n element = element.enclosingElement!;\n }\n\n String? unitMemberName;\n if (element.enclosingElement is CompilationUnitElement) {\n unitMemberName = element.name;\n if (element is ExtensionElement && unitMemberName == null) {\n var enclosingUnit = element.enclosingElement;\n var indexOf = enclosingUnit.extensions.indexOf(element);\n unitMemberName = 'extension-$indexOf';\n }\n }\n\n return ElementNameComponents._(\n parameterName: parameterName,\n classMemberName: classMemberName,\n unitMemberName: unitMemberName,\n );\n }\n\n ElementNameComponents._({\n @required this.parameterName,\n @required this.classMemberName,\n @required this.unitMemberName,\n });\n}\n\n\/\/\/ Information about an element that is actually put into index for some other\n\/\/\/ related element. For example for a synthetic getter this is the\n\/\/\/ corresponding non-synthetic field and [IndexSyntheticElementKind.getter] as\n\/\/\/ the [kind].\nclass IndexElementInfo {\n final Element element;\n final IndexSyntheticElementKind kind;\n\n factory IndexElementInfo(Element element) {\n IndexSyntheticElementKind kind = IndexSyntheticElementKind.notSynthetic;\n ElementKind elementKind = element.kind;\n if (elementKind == ElementKind.LIBRARY ||\n elementKind == ElementKind.COMPILATION_UNIT) {\n kind = IndexSyntheticElementKind.unit;\n } else if (element.isSynthetic) {\n if (elementKind == ElementKind.CONSTRUCTOR) {\n kind = IndexSyntheticElementKind.constructor;\n element = element.enclosingElement!;\n } else if (element is FunctionElement && element.name == 'loadLibrary') {\n kind = IndexSyntheticElementKind.loadLibrary;\n element = element.library;\n } else if (elementKind == ElementKind.FIELD) {\n var field = element as FieldElement;\n kind = IndexSyntheticElementKind.field;\n element = (field.getter ?? field.setter)!;\n } else if (elementKind == ElementKind.GETTER ||\n elementKind == ElementKind.SETTER) {\n var accessor = element as PropertyAccessorElement;\n Element enclosing = element.enclosingElement;\n bool isEnumGetter = enclosing is ClassElement && enclosing.isEnum;\n if (isEnumGetter && accessor.name == 'index') {\n kind = IndexSyntheticElementKind.enumIndex;\n element = enclosing;\n } else if (isEnumGetter && accessor.name == 'values') {\n kind = IndexSyntheticElementKind.enumValues;\n element = enclosing;\n } else {\n kind = accessor.isGetter\n ? IndexSyntheticElementKind.getter\n : IndexSyntheticElementKind.setter;\n element = accessor.variable;\n }\n } else if (element is MethodElement) {\n Element enclosing = element.enclosingElement;\n bool isEnumMethod = enclosing is ClassElement && enclosing.isEnum;\n if (isEnumMethod && element.name == 'toString') {\n kind = IndexSyntheticElementKind.enumToString;\n element = enclosing;\n }\n } else if (element is TopLevelVariableElement) {\n kind = IndexSyntheticElementKind.topLevelVariable;\n element = (element.getter ?? element.setter)!;\n } else {\n throw ArgumentError(\n 'Unsupported synthetic element ${element.runtimeType}');\n }\n }\n return IndexElementInfo._(element, kind);\n }\n\n IndexElementInfo._(this.element, this.kind);\n}\n\n\/\/\/ Information about an element referenced in index.\nclass _ElementInfo {\n \/\/\/ The identifier of the [CompilationUnitElement] containing this element.\n final int unitId;\n\n \/\/\/ The identifier of the top-level name, or `null` if the element is a\n \/\/\/ reference to the unit.\n final _StringInfo nameIdUnitMember;\n\n \/\/\/ The identifier of the class member name, or `null` if the element is not a\n \/\/\/ class member or a named parameter of a class member.\n final _StringInfo nameIdClassMember;\n\n \/\/\/ The identifier of the named parameter name, or `null` if the element is\n \/\/\/ not a named parameter.\n final _StringInfo nameIdParameter;\n\n \/\/\/ The kind of the element.\n final IndexSyntheticElementKind kind;\n\n \/\/\/ The unique id of the element. It is set after indexing of the whole\n \/\/\/ package is done and we are assembling the full package index.\n late int id;\n\n _ElementInfo(this.unitId, this.nameIdUnitMember, this.nameIdClassMember,\n this.nameIdParameter, this.kind);\n}\n\n\/\/\/ Information about a single relation in a single compilation unit.\nclass _ElementRelationInfo {\n final _ElementInfo elementInfo;\n final IndexRelationKind kind;\n final int offset;\n final int length;\n final bool isQualified;\n\n _ElementRelationInfo(\n this.elementInfo, this.kind, this.offset, this.length, this.isQualified);\n}\n\n\/\/\/ Assembler of a single [CompilationUnit] index.\n\/\/\/\n\/\/\/ The intended usage sequence:\n\/\/\/\n\/\/\/ - Call [addElementRelation] for each element relation found in the unit.\n\/\/\/ - Call [addNameRelation] for each name relation found in the unit.\n\/\/\/ - Assign ids to all the [_ElementInfo] in [elementRelations].\n\/\/\/ - Call [assemble] to produce the final unit index.\nclass _IndexAssembler {\n \/\/\/ The string to use in place of the `null` string.\n static const NULL_STRING = '--nullString--';\n\n \/\/\/ Map associating referenced elements with their [_ElementInfo]s.\n final Map elementMap = {};\n\n \/\/\/ Map associating [CompilationUnitElement]s with their identifiers, which\n \/\/\/ are indices into [unitLibraryUris] and [unitUnitUris].\n final Map unitMap = {};\n\n \/\/\/ The fields [unitLibraryUris] and [unitUnitUris] are used together to\n \/\/\/ describe each unique [CompilationUnitElement].\n \/\/\/\n \/\/\/ This field contains the library URI of a unit.\n final List<_StringInfo> unitLibraryUris = [];\n\n \/\/\/ The fields [unitLibraryUris] and [unitUnitUris] are used together to\n \/\/\/ describe each unique [CompilationUnitElement].\n \/\/\/\n \/\/\/ This field contains the unit URI of a unit, which might be the same as\n \/\/\/ the library URI for the defining unit, or a different one for a part.\n final List<_StringInfo> unitUnitUris = [];\n\n \/\/\/ Map associating strings with their [_StringInfo]s.\n final Map stringMap = {};\n\n \/\/\/ All element relations.\n final List<_ElementRelationInfo> elementRelations = [];\n\n \/\/\/ All unresolved name relations.\n final List<_NameRelationInfo> nameRelations = [];\n\n \/\/\/ All subtypes declared in the unit.\n final List<_SubtypeInfo> subtypes = [];\n\n \/\/\/ The [_StringInfo] to use for `null` strings.\n late final _StringInfo nullString;\n\n _IndexAssembler() {\n nullString = _getStringInfo(NULL_STRING);\n }\n\n void addElementRelation(Element element, IndexRelationKind kind, int offset,\n int length, bool isQualified) {\n _ElementInfo elementInfo = _getElementInfo(element);\n elementRelations.add(\n _ElementRelationInfo(elementInfo, kind, offset, length, isQualified));\n }\n\n void addNameRelation(\n String name, IndexRelationKind kind, int offset, bool isQualified) {\n _StringInfo nameId = _getStringInfo(name);\n nameRelations.add(_NameRelationInfo(nameId, kind, offset, isQualified));\n }\n\n void addSubtype(String name, List members, List supertypes) {\n for (var supertype in supertypes) {\n subtypes.add(\n _SubtypeInfo(\n _getStringInfo(supertype),\n _getStringInfo(name),\n members.map(_getStringInfo).toList(),\n ),\n );\n }\n }\n\n \/\/\/ Index the [unit] and assemble a new [AnalysisDriverUnitIndexBuilder].\n AnalysisDriverUnitIndexBuilder assemble(CompilationUnit unit) {\n unit.accept(_IndexContributor(this));\n\n \/\/ Sort strings and set IDs.\n List<_StringInfo> stringInfoList = stringMap.values.toList();\n stringInfoList.sort((a, b) {\n return a.value.compareTo(b.value);\n });\n for (int i = 0; i < stringInfoList.length; i++) {\n stringInfoList[i].id = i;\n }\n\n \/\/ Sort elements and set IDs.\n List<_ElementInfo> elementInfoList = elementMap.values.toList();\n elementInfoList.sort((a, b) {\n int delta;\n delta = a.nameIdUnitMember.id - b.nameIdUnitMember.id;\n if (delta != 0) {\n return delta;\n }\n delta = a.nameIdClassMember.id - b.nameIdClassMember.id;\n if (delta != 0) {\n return delta;\n }\n return a.nameIdParameter.id - b.nameIdParameter.id;\n });\n for (int i = 0; i < elementInfoList.length; i++) {\n elementInfoList[i].id = i;\n }\n\n \/\/ Sort element and name relations.\n elementRelations.sort((a, b) {\n return a.elementInfo.id - b.elementInfo.id;\n });\n nameRelations.sort((a, b) {\n return a.nameInfo.id - b.nameInfo.id;\n });\n\n \/\/ Sort subtypes by supertypes.\n subtypes.sort((a, b) {\n return a.supertype.id - b.supertype.id;\n });\n\n return AnalysisDriverUnitIndexBuilder(\n strings: stringInfoList.map((s) => s.value).toList(),\n nullStringId: nullString.id,\n unitLibraryUris: unitLibraryUris.map((s) => s.id).toList(),\n unitUnitUris: unitUnitUris.map((s) => s.id).toList(),\n elementKinds: elementInfoList.map((e) => e.kind).toList(),\n elementUnits: elementInfoList.map((e) => e.unitId).toList(),\n elementNameUnitMemberIds:\n elementInfoList.map((e) => e.nameIdUnitMember.id).toList(),\n elementNameClassMemberIds:\n elementInfoList.map((e) => e.nameIdClassMember.id).toList(),\n elementNameParameterIds:\n elementInfoList.map((e) => e.nameIdParameter.id).toList(),\n usedElements: elementRelations.map((r) => r.elementInfo.id).toList(),\n usedElementKinds: elementRelations.map((r) => r.kind).toList(),\n usedElementOffsets: elementRelations.map((r) => r.offset).toList(),\n usedElementLengths: elementRelations.map((r) => r.length).toList(),\n usedElementIsQualifiedFlags:\n elementRelations.map((r) => r.isQualified).toList(),\n usedNames: nameRelations.map((r) => r.nameInfo.id).toList(),\n usedNameKinds: nameRelations.map((r) => r.kind).toList(),\n usedNameOffsets: nameRelations.map((r) => r.offset).toList(),\n usedNameIsQualifiedFlags:\n nameRelations.map((r) => r.isQualified).toList(),\n supertypes: subtypes.map((subtype) => subtype.supertype.id).toList(),\n subtypes: subtypes.map((subtype) {\n return AnalysisDriverSubtypeBuilder(\n name: subtype.name.id,\n members: subtype.members.map((member) => member.id).toList(),\n );\n }).toList());\n }\n\n \/\/\/ Return the unique [_ElementInfo] corresponding the [element]. The field\n \/\/\/ [_ElementInfo.id] is filled by [assemble] during final sorting.\n _ElementInfo _getElementInfo(Element element) {\n element = element.declaration!;\n return elementMap.putIfAbsent(element, () {\n CompilationUnitElement unitElement = getUnitElement(element);\n int unitId = _getUnitId(unitElement);\n return _newElementInfo(unitId, element);\n });\n }\n\n \/\/\/ Return the unique [_StringInfo] corresponding the given [string]. The\n \/\/\/ field [_StringInfo.id] is filled by [assemble] during final sorting.\n _StringInfo _getStringInfo(String? string) {\n if (string == null) {\n return nullString;\n }\n\n return stringMap.putIfAbsent(string, () {\n return _StringInfo(string);\n });\n }\n\n \/\/\/ Add information about [unitElement] to [unitUnitUris] and\n \/\/\/ [unitLibraryUris] if necessary, and return the location in those\n \/\/\/ arrays representing [unitElement].\n int _getUnitId(CompilationUnitElement unitElement) {\n return unitMap.putIfAbsent(unitElement, () {\n assert(unitLibraryUris.length == unitUnitUris.length);\n int id = unitUnitUris.length;\n unitLibraryUris.add(_getUriInfo(unitElement.library.source.uri));\n unitUnitUris.add(_getUriInfo(unitElement.source.uri));\n return id;\n });\n }\n\n \/\/\/ Return the unique [_StringInfo] corresponding [uri]. The field\n \/\/\/ [_StringInfo.id] is filled by [assemble] during final sorting.\n _StringInfo _getUriInfo(Uri uri) {\n String str = uri.toString();\n return _getStringInfo(str);\n }\n\n \/\/\/ Return a new [_ElementInfo] for the given [element] in the given [unitId].\n \/\/\/ This method is static, so it cannot add any information to the index.\n _ElementInfo _newElementInfo(int unitId, Element element) {\n IndexElementInfo info = IndexElementInfo(element);\n element = info.element;\n\n var components = ElementNameComponents(element);\n return _ElementInfo(\n unitId,\n _getStringInfo(components.unitMemberName),\n _getStringInfo(components.classMemberName),\n _getStringInfo(components.parameterName),\n info.kind,\n );\n }\n}\n\n\/\/\/ Visits a resolved AST and adds relationships into the [assembler].\nclass _IndexContributor extends GeneralizingAstVisitor {\n final _IndexAssembler assembler;\n\n _IndexContributor(this.assembler);\n\n void recordIsAncestorOf(ClassElement descendant) {\n _recordIsAncestorOf(descendant, descendant, false, []);\n }\n\n \/\/\/ Record that the name [node] has a relation of the given [kind].\n void recordNameRelation(\n SimpleIdentifier node, IndexRelationKind kind, bool isQualified) {\n assembler.addNameRelation(node.name, kind, node.offset, isQualified);\n }\n\n \/\/\/ Record reference to the given operator [Element].\n void recordOperatorReference(Token operator, Element? element) {\n recordRelationToken(element, IndexRelationKind.IS_INVOKED_BY, operator);\n }\n\n \/\/\/ Record that [element] has a relation of the given [kind] at the location\n \/\/\/ of the given [node]. The flag [isQualified] is `true` if [node] has an\n \/\/\/ explicit or implicit qualifier, so cannot be shadowed by a local\n \/\/\/ declaration.\n void recordRelation(Element? element, IndexRelationKind kind, AstNode node,\n bool isQualified) {\n if (element != null) {\n recordRelationOffset(\n element, kind, node.offset, node.length, isQualified);\n }\n }\n\n \/\/\/ Record that [element] has a relation of the given [kind] at the given\n \/\/\/ [offset] and [length]. The flag [isQualified] is `true` if the relation\n \/\/\/ has an explicit or implicit qualifier, so [element] cannot be shadowed by\n \/\/\/ a local declaration.\n void recordRelationOffset(Element? element, IndexRelationKind kind,\n int offset, int length, bool isQualified) {\n if (element == null) return;\n\n \/\/ Ignore elements that can't be referenced outside of the unit.\n ElementKind elementKind = element.kind;\n if (elementKind == ElementKind.DYNAMIC ||\n elementKind == ElementKind.ERROR ||\n elementKind == ElementKind.LABEL ||\n elementKind == ElementKind.LOCAL_VARIABLE ||\n elementKind == ElementKind.NEVER ||\n elementKind == ElementKind.PREFIX ||\n elementKind == ElementKind.TYPE_PARAMETER ||\n elementKind == ElementKind.FUNCTION &&\n element is FunctionElement &&\n element.enclosingElement is ExecutableElement ||\n false) {\n return;\n }\n \/\/ Ignore named parameters of synthetic functions, e.g. created for LUB.\n \/\/ These functions are not bound to a source, we cannot index them.\n if (elementKind == ElementKind.PARAMETER && element is ParameterElement) {\n var enclosingElement = element.enclosingElement;\n if (enclosingElement == null || enclosingElement.isSynthetic) {\n return;\n }\n }\n \/\/ Elements for generic function types are enclosed by the compilation\n \/\/ units, but don't have names. So, we cannot index references to their\n \/\/ named parameters. Ignore them.\n if (elementKind == ElementKind.PARAMETER &&\n element is ParameterElement &&\n element.enclosingElement is GenericFunctionTypeElement) {\n return;\n }\n \/\/ Add the relation.\n assembler.addElementRelation(element, kind, offset, length, isQualified);\n }\n\n \/\/\/ Record that [element] has a relation of the given [kind] at the location\n \/\/\/ of the given [token].\n void recordRelationToken(\n Element? element, IndexRelationKind kind, Token token) {\n recordRelationOffset(element, kind, token.offset, token.length, true);\n }\n\n \/\/\/ Record a relation between a super [typeName] and its [Element].\n void recordSuperType(TypeName typeName, IndexRelationKind kind) {\n Identifier name = typeName.name;\n Element? element = name.staticElement;\n bool isQualified;\n SimpleIdentifier relNode;\n if (name is PrefixedIdentifier) {\n isQualified = true;\n relNode = name.identifier;\n } else {\n isQualified = false;\n relNode = name as SimpleIdentifier;\n }\n recordRelation(element, kind, relNode, isQualified);\n recordRelation(\n element, IndexRelationKind.IS_REFERENCED_BY, relNode, isQualified);\n typeName.typeArguments?.accept(this);\n }\n\n void recordUriReference(Element? element, StringLiteral uri) {\n recordRelation(element, IndexRelationKind.IS_REFERENCED_BY, uri, true);\n }\n\n @override\n void visitAssignmentExpression(AssignmentExpression node) {\n recordOperatorReference(node.operator, node.staticElement);\n super.visitAssignmentExpression(node);\n }\n\n @override\n void visitBinaryExpression(BinaryExpression node) {\n recordOperatorReference(node.operator, node.staticElement);\n super.visitBinaryExpression(node);\n }\n\n @override\n void visitClassDeclaration(ClassDeclaration node) {\n _addSubtypeForClassDeclaration(node);\n var declaredElement = node.declaredElement!;\n if (node.extendsClause == null) {\n ClassElement? objectElement = declaredElement.supertype?.element;\n recordRelationOffset(objectElement, IndexRelationKind.IS_EXTENDED_BY,\n node.name.offset, 0, true);\n }\n recordIsAncestorOf(declaredElement);\n super.visitClassDeclaration(node);\n }\n\n @override\n void visitClassTypeAlias(ClassTypeAlias node) {\n _addSubtypeForClassTypeAlis(node);\n recordIsAncestorOf(node.declaredElement!);\n super.visitClassTypeAlias(node);\n }\n\n @override\n visitCommentReference(CommentReference node) {\n var identifier = node.identifier;\n var element = identifier.staticElement;\n if (element is ConstructorElement) {\n if (identifier is PrefixedIdentifier) {\n var offset = identifier.prefix.end;\n var length = identifier.end - offset;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, length, true);\n return;\n } else {\n var offset = identifier.end;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, 0, true);\n return;\n }\n }\n\n return super.visitCommentReference(node);\n }\n\n @override\n void visitConstructorFieldInitializer(ConstructorFieldInitializer node) {\n var fieldName = node.fieldName;\n var element = fieldName.staticElement;\n recordRelation(element, IndexRelationKind.IS_WRITTEN_BY, fieldName, true);\n node.expression.accept(this);\n }\n\n @override\n void visitConstructorName(ConstructorName node) {\n ConstructorElement? element = node.staticElement;\n element = _getActualConstructorElement(element);\n \/\/ record relation\n if (node.name != null) {\n int offset = node.period!.offset;\n int length = node.name!.end - offset;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, length, true);\n } else {\n int offset = node.type.end;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, 0, true);\n }\n node.type.accept(this);\n }\n\n @override\n void visitExportDirective(ExportDirective node) {\n ExportElement? element = node.element;\n recordUriReference(element?.exportedLibrary, node.uri);\n super.visitExportDirective(node);\n }\n\n @override\n void visitExpression(Expression node) {\n ParameterElement? parameterElement = node.staticParameterElement;\n if (parameterElement != null && parameterElement.isOptionalPositional) {\n recordRelationOffset(parameterElement, IndexRelationKind.IS_REFERENCED_BY,\n node.offset, 0, true);\n }\n super.visitExpression(node);\n }\n\n @override\n void visitExtendsClause(ExtendsClause node) {\n recordSuperType(node.superclass, IndexRelationKind.IS_EXTENDED_BY);\n }\n\n @override\n void visitImplementsClause(ImplementsClause node) {\n for (TypeName typeName in node.interfaces) {\n recordSuperType(typeName, IndexRelationKind.IS_IMPLEMENTED_BY);\n }\n }\n\n @override\n void visitImportDirective(ImportDirective node) {\n ImportElement? element = node.element;\n recordUriReference(element?.importedLibrary, node.uri);\n super.visitImportDirective(node);\n }\n\n @override\n void visitIndexExpression(IndexExpression node) {\n Element? element = node.writeOrReadElement;\n if (element is MethodElement) {\n Token operator = node.leftBracket;\n recordRelationToken(element, IndexRelationKind.IS_INVOKED_BY, operator);\n }\n super.visitIndexExpression(node);\n }\n\n @override\n void visitLibraryIdentifier(LibraryIdentifier node) {}\n\n @override\n void visitMethodInvocation(MethodInvocation node) {\n SimpleIdentifier name = node.methodName;\n Element? element = name.staticElement;\n \/\/ unresolved name invocation\n bool isQualified = node.realTarget != null;\n if (element == null) {\n recordNameRelation(name, IndexRelationKind.IS_INVOKED_BY, isQualified);\n }\n \/\/ element invocation\n IndexRelationKind kind = element is ClassElement\n ? IndexRelationKind.IS_REFERENCED_BY\n : IndexRelationKind.IS_INVOKED_BY;\n recordRelation(element, kind, name, isQualified);\n node.target?.accept(this);\n node.typeArguments?.accept(this);\n node.argumentList.accept(this);\n }\n\n @override\n void visitMixinDeclaration(MixinDeclaration node) {\n _addSubtypeForMixinDeclaration(node);\n recordIsAncestorOf(node.declaredElement!);\n super.visitMixinDeclaration(node);\n }\n\n @override\n void visitOnClause(OnClause node) {\n for (TypeName typeName in node.superclassConstraints) {\n recordSuperType(typeName, IndexRelationKind.IS_IMPLEMENTED_BY);\n }\n }\n\n @override\n void visitPartDirective(PartDirective node) {\n var element = node.element as CompilationUnitElement?;\n if (element?.source != null) {\n recordUriReference(element, node.uri);\n }\n super.visitPartDirective(node);\n }\n\n @override\n void visitPostfixExpression(PostfixExpression node) {\n recordOperatorReference(node.operator, node.staticElement);\n super.visitPostfixExpression(node);\n }\n\n @override\n void visitPrefixExpression(PrefixExpression node) {\n recordOperatorReference(node.operator, node.staticElement);\n super.visitPrefixExpression(node);\n }\n\n @override\n void visitRedirectingConstructorInvocation(\n RedirectingConstructorInvocation node) {\n var element = node.staticElement;\n if (node.constructorName != null) {\n int offset = node.period!.offset;\n int length = node.constructorName!.end - offset;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, length, true);\n } else {\n int offset = node.thisKeyword.end;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, 0, true);\n }\n super.visitRedirectingConstructorInvocation(node);\n }\n\n @override\n void visitSimpleIdentifier(SimpleIdentifier node) {\n \/\/ name in declaration\n if (node.inDeclarationContext()) {\n return;\n }\n\n Element? element = node.writeOrReadElement;\n if (node is SimpleIdentifier && element is ParameterElement) {\n element = declaredParameterElement(node, element);\n }\n\n \/\/ record unresolved name reference\n bool isQualified = _isQualified(node);\n if (element == null) {\n bool inGetterContext = node.inGetterContext();\n bool inSetterContext = node.inSetterContext();\n IndexRelationKind kind;\n if (inGetterContext && inSetterContext) {\n kind = IndexRelationKind.IS_READ_WRITTEN_BY;\n } else if (inGetterContext) {\n kind = IndexRelationKind.IS_READ_BY;\n } else {\n kind = IndexRelationKind.IS_WRITTEN_BY;\n }\n recordNameRelation(node, kind, isQualified);\n }\n \/\/ this.field parameter\n if (element is FieldFormalParameterElement) {\n AstNode parent = node.parent!;\n IndexRelationKind kind =\n parent is FieldFormalParameter && parent.identifier == node\n ? IndexRelationKind.IS_WRITTEN_BY\n : IndexRelationKind.IS_REFERENCED_BY;\n recordRelation(element.field, kind, node, true);\n return;\n }\n \/\/ ignore a local reference to a parameter\n if (element is ParameterElement && node.parent is! Label) {\n return;\n }\n \/\/ record specific relations\n recordRelation(\n element, IndexRelationKind.IS_REFERENCED_BY, node, isQualified);\n }\n\n @override\n void visitSuperConstructorInvocation(SuperConstructorInvocation node) {\n var element = node.staticElement;\n if (node.constructorName != null) {\n int offset = node.period!.offset;\n int length = node.constructorName!.end - offset;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, length, true);\n } else {\n int offset = node.superKeyword.end;\n recordRelationOffset(\n element, IndexRelationKind.IS_REFERENCED_BY, offset, 0, true);\n }\n node.argumentList.accept(this);\n }\n\n @override\n void visitTypeName(TypeName node) {\n AstNode parent = node.parent!;\n if (parent is ClassTypeAlias && parent.superclass == node) {\n recordSuperType(node, IndexRelationKind.IS_EXTENDED_BY);\n } else {\n super.visitTypeName(node);\n }\n }\n\n @override\n void visitWithClause(WithClause node) {\n for (TypeName typeName in node.mixinTypes) {\n recordSuperType(typeName, IndexRelationKind.IS_MIXED_IN_BY);\n }\n }\n\n \/\/\/ Record the given class as a subclass of its direct superclasses.\n void _addSubtype(String name,\n {TypeName? superclass,\n WithClause? withClause,\n OnClause? onClause,\n ImplementsClause? implementsClause,\n required List memberNodes}) {\n List supertypes = [];\n List members = [];\n\n String getClassElementId(ClassElement element) {\n return element.library.source.uri.toString() +\n ';' +\n element.source.uri.toString() +\n ';' +\n element.name;\n }\n\n void addSupertype(TypeName? type) {\n var element = type?.name.staticElement;\n if (element is ClassElement) {\n String id = getClassElementId(element);\n supertypes.add(id);\n }\n }\n\n addSupertype(superclass);\n withClause?.mixinTypes.forEach(addSupertype);\n onClause?.superclassConstraints.forEach(addSupertype);\n implementsClause?.interfaces.forEach(addSupertype);\n\n void addMemberName(SimpleIdentifier identifier) {\n String name = identifier.name;\n if (name.isNotEmpty) {\n members.add(name);\n }\n }\n\n for (ClassMember member in memberNodes) {\n if (member is MethodDeclaration && !member.isStatic) {\n addMemberName(member.name);\n } else if (member is FieldDeclaration && !member.isStatic) {\n for (var field in member.fields.variables) {\n addMemberName(field.name);\n }\n }\n }\n\n supertypes.sort();\n members.sort();\n\n assembler.addSubtype(name, members, supertypes);\n }\n\n \/\/\/ Record the given class as a subclass of its direct superclasses.\n void _addSubtypeForClassDeclaration(ClassDeclaration node) {\n _addSubtype(node.name.name,\n superclass: node.extendsClause?.superclass,\n withClause: node.withClause,\n implementsClause: node.implementsClause,\n memberNodes: node.members);\n }\n\n \/\/\/ Record the given class as a subclass of its direct superclasses.\n void _addSubtypeForClassTypeAlis(ClassTypeAlias node) {\n _addSubtype(node.name.name,\n superclass: node.superclass,\n withClause: node.withClause,\n implementsClause: node.implementsClause,\n memberNodes: const []);\n }\n\n \/\/\/ Record the given mixin as a subclass of its direct superclasses.\n void _addSubtypeForMixinDeclaration(MixinDeclaration node) {\n _addSubtype(node.name.name,\n onClause: node.onClause,\n implementsClause: node.implementsClause,\n memberNodes: node.members);\n }\n\n \/\/\/ If the given [constructor] is a synthetic constructor created for a\n \/\/\/ [ClassTypeAlias], return the actual constructor of a [ClassDeclaration]\n \/\/\/ which is invoked. Return `null` if a redirection cycle is detected.\n ConstructorElement? _getActualConstructorElement(\n ConstructorElement? constructor) {\n var seenConstructors = {};\n while (constructor != null &&\n constructor.isSynthetic &&\n constructor.redirectedConstructor != null) {\n constructor = constructor.redirectedConstructor;\n \/\/ fail if a cycle is detected\n if (!seenConstructors.add(constructor)) {\n return null;\n }\n }\n return constructor;\n }\n\n \/\/\/ Return `true` if [node] has an explicit or implicit qualifier, so that it\n \/\/\/ cannot be shadowed by a local declaration.\n bool _isQualified(SimpleIdentifier node) {\n if (node.isQualified) {\n return true;\n }\n AstNode parent = node.parent!;\n return parent is Combinator || parent is Label;\n }\n\n void _recordIsAncestorOf(Element descendant, ClassElement ancestor,\n bool includeThis, List visitedElements) {\n if (visitedElements.contains(ancestor)) {\n return;\n }\n visitedElements.add(ancestor);\n if (includeThis) {\n int offset = descendant.nameOffset;\n int length = descendant.nameLength;\n assembler.addElementRelation(\n ancestor, IndexRelationKind.IS_ANCESTOR_OF, offset, length, false);\n }\n {\n var superType = ancestor.supertype;\n if (superType != null) {\n _recordIsAncestorOf(\n descendant, superType.element, true, visitedElements);\n }\n }\n for (InterfaceType mixinType in ancestor.mixins) {\n _recordIsAncestorOf(descendant, mixinType.element, true, visitedElements);\n }\n for (InterfaceType type in ancestor.superclassConstraints) {\n _recordIsAncestorOf(descendant, type.element, true, visitedElements);\n }\n for (InterfaceType implementedType in ancestor.interfaces) {\n _recordIsAncestorOf(\n descendant, implementedType.element, true, visitedElements);\n }\n }\n}\n\n\/\/\/ Information about a single name relation in single compilation unit.\nclass _NameRelationInfo {\n final _StringInfo nameInfo;\n final IndexRelationKind kind;\n final int offset;\n final bool isQualified;\n\n _NameRelationInfo(this.nameInfo, this.kind, this.offset, this.isQualified);\n}\n\n\/\/\/ Information about a string referenced in the index.\nclass _StringInfo {\n \/\/\/ The value of the string.\n final String value;\n\n \/\/\/ The unique id of the string. It is set after indexing of the whole\n \/\/\/ package is done and we are assembling the full package index.\n late int id;\n\n _StringInfo(this.value);\n}\n\n\/\/\/ Information about a subtype in the index.\nclass _SubtypeInfo {\n \/\/\/ The identifier of a direct supertype.\n final _StringInfo supertype;\n\n \/\/\/ The name of the class.\n final _StringInfo name;\n\n \/\/\/ The names of defined instance members.\n final List<_StringInfo> members;\n\n _SubtypeInfo(this.supertype, this.name, this.members);\n}\n","avg_line_length":34.8958958959,"max_line_length":80,"alphanum_fraction":0.6949026132} {"size":618,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"@TestOn('browser')\nimport 'package:angular_test\/angular_test.dart';\nimport 'package:test\/test.dart';\nimport 'package:first_app\/app_component.dart';\nimport 'package:first_app\/app_component.template.dart' as ng;\n\nvoid main() {\n final testBed =\n NgTestBed.forComponent(ng.AppComponentNgFactory);\n NgTestFixture fixture;\n\n setUp(() async {\n fixture = await testBed.create();\n });\n\n tearDown(disposeAnyRunningTest);\n\n test('heading', () {\n expect(fixture.text, contains('My First AngularDart App'));\n });\n\n \/\/ Testing info: https:\/\/webdev.dartlang.org\/angular\/guide\/testing\n}\n","avg_line_length":25.75,"max_line_length":69,"alphanum_fraction":0.7281553398} {"size":142,"ext":"dart","lang":"Dart","max_stars_count":47.0,"content":"import 'package:absract_class\/character.dart';\n\nabstract class Monster extends Character {\n String eatHuman() => 'yummy';\n String move();\n}\n","avg_line_length":20.2857142857,"max_line_length":46,"alphanum_fraction":0.7323943662} {"size":3305,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/\/\n\/\/ Generated code. Do not modify.\n\/\/ source: cosmos\/gov\/v1beta1\/gov.proto\n\/\/\n\/\/ @dart = 2.12\n\/\/ ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields\n\n\/\/ ignore_for_file: UNDEFINED_SHOWN_NAME\nimport 'dart:core' as $core;\nimport 'package:protobuf\/protobuf.dart' as $pb;\n\nclass VoteOption extends $pb.ProtobufEnum {\n static const VoteOption VOTE_OPTION_UNSPECIFIED = VoteOption._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'VOTE_OPTION_UNSPECIFIED');\n static const VoteOption VOTE_OPTION_YES = VoteOption._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'VOTE_OPTION_YES');\n static const VoteOption VOTE_OPTION_ABSTAIN = VoteOption._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'VOTE_OPTION_ABSTAIN');\n static const VoteOption VOTE_OPTION_NO = VoteOption._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'VOTE_OPTION_NO');\n static const VoteOption VOTE_OPTION_NO_WITH_VETO = VoteOption._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'VOTE_OPTION_NO_WITH_VETO');\n\n static const $core.List values = [\n VOTE_OPTION_UNSPECIFIED,\n VOTE_OPTION_YES,\n VOTE_OPTION_ABSTAIN,\n VOTE_OPTION_NO,\n VOTE_OPTION_NO_WITH_VETO,\n ];\n\n static final $core.Map<$core.int, VoteOption> _byValue = $pb.ProtobufEnum.initByValue(values);\n static VoteOption? valueOf($core.int value) => _byValue[value];\n\n const VoteOption._($core.int v, $core.String n) : super(v, n);\n}\n\nclass ProposalStatus extends $pb.ProtobufEnum {\n static const ProposalStatus PROPOSAL_STATUS_UNSPECIFIED = ProposalStatus._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PROPOSAL_STATUS_UNSPECIFIED');\n static const ProposalStatus PROPOSAL_STATUS_DEPOSIT_PERIOD = ProposalStatus._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PROPOSAL_STATUS_DEPOSIT_PERIOD');\n static const ProposalStatus PROPOSAL_STATUS_VOTING_PERIOD = ProposalStatus._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PROPOSAL_STATUS_VOTING_PERIOD');\n static const ProposalStatus PROPOSAL_STATUS_PASSED = ProposalStatus._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PROPOSAL_STATUS_PASSED');\n static const ProposalStatus PROPOSAL_STATUS_REJECTED = ProposalStatus._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PROPOSAL_STATUS_REJECTED');\n static const ProposalStatus PROPOSAL_STATUS_FAILED = ProposalStatus._(5, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PROPOSAL_STATUS_FAILED');\n\n static const $core.List values = [\n PROPOSAL_STATUS_UNSPECIFIED,\n PROPOSAL_STATUS_DEPOSIT_PERIOD,\n PROPOSAL_STATUS_VOTING_PERIOD,\n PROPOSAL_STATUS_PASSED,\n PROPOSAL_STATUS_REJECTED,\n PROPOSAL_STATUS_FAILED,\n ];\n\n static final $core.Map<$core.int, ProposalStatus> _byValue = $pb.ProtobufEnum.initByValue(values);\n static ProposalStatus? valueOf($core.int value) => _byValue[value];\n\n const ProposalStatus._($core.int v, $core.String n) : super(v, n);\n}\n\n","avg_line_length":59.0178571429,"max_line_length":212,"alphanum_fraction":0.7818456884} {"size":8644,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:campus_mobile_experimental\/app_constants.dart';\nimport 'package:campus_mobile_experimental\/core\/models\/cards.dart';\nimport 'package:campus_mobile_experimental\/core\/services\/cards.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:hive\/hive.dart';\n\nclass CardsDataProvider extends ChangeNotifier {\n CardsDataProvider() {\n \/\/\/DEFAULT STATES\n _isLoading = false;\n _cardStates = {};\n _webCards = {};\n _cardOrder = [\n 'QRScanner',\n 'NativeScanner',\n 'MyStudentChart',\n 'MyUCSDChart',\n 'student_id',\n 'campus_info',\n 'staff_id',\n 'staff_info',\n 'student_info',\n 'student_survey',\n 'finals',\n 'schedule',\n 'shuttle',\n 'dining',\n 'parking',\n 'availability',\n 'events',\n 'news',\n 'weather',\n ];\n\n _studentCards = [\n 'student_survey',\n 'student_info',\n 'student_id',\n 'finals',\n 'schedule'\n ];\n\n _staffCards = [\n 'MyUCSDChart',\n 'staff_info',\n 'staff_id',\n ];\n\n for (String card in CardTitleConstants.titleMap.keys.toList()) {\n _cardStates[card] = true;\n }\n\n \/\/\/ temporary fix that prevents the student cards from causing issues on launch\n _cardOrder.removeWhere((element) => _studentCards.contains(element));\n _cardStates.removeWhere((key, value) => _studentCards.contains(key));\n\n _cardOrder.removeWhere((element) => _staffCards.contains(element));\n _cardStates.removeWhere((key, value) => _staffCards.contains(key));\n }\n\n \/\/\/STATES\n bool _isLoading;\n DateTime _lastUpdated;\n String _error;\n List _cardOrder;\n Map _cardStates;\n Map _webCards;\n List _studentCards;\n List _staffCards;\n Map _availableCards;\n Box _cardOrderBox;\n Box _cardStateBox;\n\n \/\/\/Services\n final CardsService _cardsService = CardsService();\n\n void updateAvailableCards(String ucsdAffiliation) async {\n _isLoading = true;\n _error = null;\n notifyListeners();\n if (await _cardsService.fetchCards(ucsdAffiliation)) {\n _availableCards = _cardsService.cardsModel;\n _lastUpdated = DateTime.now();\n if (_availableCards.isNotEmpty) {\n \/\/ remove all inactive or non-existent cards from [_cardOrder]\n var tempCardOrder = List.from(_cardOrder);\n for (String card in tempCardOrder) {\n \/\/ check to see if card no longer exists\n if (_availableCards[card] == null) {\n _cardOrder.remove(card);\n }\n \/\/ check to see if card is not active\n else if (!(_availableCards[card].cardActive ?? false)) {\n _cardOrder.remove(card);\n }\n }\n \/\/ remove all inactive or non-existent cards from [_cardStates]\n var tempCardStates = Map.from(_cardStates);\n for (String card in tempCardStates.keys) {\n \/\/ check to see if card no longer exists\n if (_availableCards[card] == null) {\n _cardStates.remove(card);\n }\n \/\/ check to see if card is not active\n else if (!(_availableCards[card].cardActive ?? false)) {\n _cardStates.remove(card);\n }\n }\n\n \/\/ add active webCards\n for (String card in _cardStates.keys) {\n if (_availableCards[card].isWebCard) {\n _webCards[card] = _availableCards[card];\n }\n }\n \/\/ add new cards to the top of the list\n for (String card in _availableCards.keys) {\n if (_studentCards.contains(card)) continue;\n if (_staffCards.contains(card)) continue;\n if (!_cardOrder.contains(card) &&\n (_availableCards[card].cardActive ?? false)) {\n _cardOrder.insert(0, card);\n }\n \/\/ keep all new cards activated by default\n if (!_cardStates.containsKey(card)) {\n _cardStates[card] = true;\n }\n }\n updateCardOrder(_cardOrder);\n updateCardStates(\n _cardStates.keys.where((card) => _cardStates[card]).toList());\n }\n } else {\n \/\/\/TODO: determine what error to show to the user\n _error = _cardsService.error;\n }\n _isLoading = false;\n notifyListeners();\n }\n\n Future loadSavedData() async {\n await _loadCardOrder();\n await _loadCardStates();\n }\n\n \/\/\/ Update the [_cardOrder] stored in state\n \/\/\/ overwrite the [_cardOrder] in persistent storage with the model passed in\n Future updateCardOrder(List newOrder) async {\n try {\n await _cardOrderBox.put(DataPersistence.cardOrder, newOrder);\n } catch (e) {\n _cardOrderBox = await Hive.openBox(DataPersistence.cardOrder);\n await _cardOrderBox.put(DataPersistence.cardOrder, newOrder);\n }\n _cardOrder = newOrder;\n _lastUpdated = DateTime.now();\n notifyListeners();\n }\n\n \/\/\/ Load [_cardOrder] from persistent storage\n \/\/\/ Will create persistent storage if no data is found\n Future _loadCardOrder() async {\n _cardOrderBox = await Hive.openBox(DataPersistence.cardOrder);\n if (_cardOrderBox.get(DataPersistence.cardOrder) == null) {\n await _cardOrderBox.put(DataPersistence.cardOrder, _cardOrder);\n }\n _cardOrder = _cardOrderBox.get(DataPersistence.cardOrder);\n notifyListeners();\n }\n\n \/\/\/ Load [_cardStates] from persistent storage\n \/\/\/ Will create persistent storage if no data is found\n Future _loadCardStates() async {\n _cardStateBox = await Hive.openBox(DataPersistence.cardStates);\n \/\/ if no data was found then create the data and save it\n \/\/ by default all cards will be on\n if (_cardStateBox.get(DataPersistence.cardStates) == null) {\n await _cardStateBox.put(DataPersistence.cardStates,\n _cardStates.keys.where((card) => _cardStates[card]).toList());\n } else {\n _deactivateAllCards();\n }\n for (String activeCard in _cardStateBox.get(DataPersistence.cardStates)) {\n _cardStates[activeCard] = true;\n }\n notifyListeners();\n }\n\n \/\/\/ Update the [_cardStates] stored in state\n \/\/\/ overwrite the [_cardStates] in persistent storage with the model passed in\n Future updateCardStates(List activeCards) async {\n for (String activeCard in activeCards) {\n _cardStates[activeCard] = true;\n }\n try {\n _cardStateBox.put(DataPersistence.cardStates, activeCards);\n } catch (e) {\n _cardStateBox = await Hive.openBox(DataPersistence.cardStates);\n _cardStateBox.put(DataPersistence.cardStates, activeCards);\n }\n _lastUpdated = DateTime.now();\n notifyListeners();\n }\n\n _deactivateAllCards() {\n for (String card in _cardStates.keys) {\n _cardStates[card] = false;\n }\n }\n\n activateStudentCards() {\n int index = _cardOrder.indexOf('MyStudentChart') + 1;\n _cardOrder.insertAll(index, _studentCards.toList());\n\n \/\/ TODO: test w\/o this\n _cardOrder = List.from(_cardOrder.toSet().toList());\n for (String card in _studentCards) {\n _cardStates[card] = true;\n }\n updateCardOrder(_cardOrder);\n updateCardStates(\n _cardStates.keys.where((card) => _cardStates[card]).toList());\n }\n\n deactivateStudentCards() {\n for (String card in _studentCards) {\n _cardOrder.remove(card);\n _cardStates[card] = false;\n }\n updateCardOrder(_cardOrder);\n updateCardStates(\n _cardStates.keys.where((card) => _cardStates[card]).toList());\n }\n\n activateStaffCards() {\n int index = _cardOrder.indexOf('MyStudentChart') + 1;\n _cardOrder.insertAll(index, _staffCards.toList());\n\n \/\/ TODO: test w\/o this\n _cardOrder = List.from(_cardOrder.toSet().toList());\n for (String card in _staffCards) {\n _cardStates[card] = true;\n }\n updateCardOrder(_cardOrder);\n updateCardStates(\n _cardStates.keys.where((card) => _cardStates[card]).toList());\n }\n\n deactivateStaffCards() {\n for (String card in _staffCards) {\n _cardOrder.remove(card);\n _cardStates[card] = false;\n }\n updateCardOrder(_cardOrder);\n updateCardStates(\n _cardStates.keys.where((card) => _cardStates[card]).toList());\n }\n\n void reorderCards(List order) {\n _cardOrder = order;\n notifyListeners();\n }\n\n void toggleCard(String card) {\n _cardStates[card] = !_cardStates[card];\n updateCardStates(\n _cardStates.keys.where((card) => _cardStates[card]).toList());\n }\n\n \/\/\/SIMPLE GETTERS\n bool get isLoading => _isLoading;\n String get error => _error;\n DateTime get lastUpdated => _lastUpdated;\n\n Map get cardStates => _cardStates;\n List get cardOrder => _cardOrder;\n Map get webCards => _webCards;\n}\n","avg_line_length":30.982078853,"max_line_length":83,"alphanum_fraction":0.6502776492} {"size":4793,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:driver\/Locale\/locales.dart';\nimport 'package:driver\/Themes\/colors.dart';\nimport 'package:driver\/baseurl\/baseurl.dart';\nimport 'package:driver\/baseurl\/orderbean.dart';\nimport 'package:flutter\/material.dart';\n\nclass ItemDetails extends StatelessWidget {\n dynamic cart_id;\n List orderDeatisSub;\n dynamic currency;\n\n @override\n Widget build(BuildContext context) {\n var locale = AppLocalizations.of(context);\n final Map dataObject =\n ModalRoute.of(context).settings.arguments;\n cart_id = '${dataObject['cart_id']}';\n orderDeatisSub = dataObject['itemDetails'] as List;\n currency = dataObject['currency'];\n\n return Scaffold(\n backgroundColor: kCardBackgroundColor,\n appBar: PreferredSize(\n preferredSize: Size.fromHeight(70.0),\n child: Padding(\n padding: const EdgeInsets.only(top: 12.0),\n child: AppBar(\n backgroundColor: kWhiteColor,\n automaticallyImplyLeading: true,\n title: Text(locale.orderItemDetail+\"\"+cart_id,\n \/\/'Order Item Detail\\'s - #${cart_id}',\n style: Theme.of(context)\n .textTheme\n .headline4\n .copyWith(fontWeight: FontWeight.w500)),\n ),\n ),\n ),\n body: SingleChildScrollView(\n primary: true,\n child: Column(\n children: [\n SizedBox(\n height: 10,\n ),\n ListView.separated(\n primary: false,\n shrinkWrap: true,\n itemBuilder: (context, index) {\n return Card(\n margin: EdgeInsets.symmetric(horizontal: 5),\n child: Container(\n color: kWhiteColor,\n margin: EdgeInsets.symmetric(vertical: 10),\n child: Row(\n children: [\n Image.network(\n '$imageBaseUrl${orderDeatisSub[index].varient_image}',\n height: 90.3,\n width: 90.3,\n ),\n SizedBox(\n width: 10,\n ),\n Expanded(\n child: Padding(\n padding: EdgeInsets.only(right: 10),\n child: Column(\n crossAxisAlignment: CrossAxisAlignment.start,\n children: [\n Padding(\n padding: EdgeInsets.only(bottom: 5),\n child: Text(\n '${orderDeatisSub[index].product_name}',\n style: TextStyle(\n fontSize: 18,\n color: kMainTextColor,\n fontWeight: FontWeight.w600),\n ),\n ),\n Padding(\n padding: EdgeInsets.only(bottom: 5),\n child: Text(\n '${orderDeatisSub[index].description}',\n style: TextStyle(\n fontSize: 16,\n color: kMainTextColor,\n fontWeight: FontWeight.w400),\n ),\n ),\n Text(\n '(${orderDeatisSub[index].quantity}${orderDeatisSub[index].unit} x ${orderDeatisSub[index].qty})',\n style: TextStyle(\n fontSize: 14,\n color: kMainTextColor,\n fontWeight: FontWeight.w300),\n )\n ],\n ),\n ),\n )\n ],\n ),\n ),\n );\n },\n separatorBuilder: (context, index) {\n return Divider(\n color: Colors.transparent,\n height: 5,\n );\n },\n itemCount: orderDeatisSub.length),\n SizedBox(\n height: 10,\n ),\n ],\n ),\n ),\n );\n }\n}\n","avg_line_length":38.9674796748,"max_line_length":134,"alphanum_fraction":0.3851450031} {"size":689,"ext":"dart","lang":"Dart","max_stars_count":3.0,"content":"import 'dart:io';\nimport 'dart:typed_data';\n\nimport 'package:flutter\/widgets.dart';\nimport 'package:flutter_svg\/flutter_svg.dart';\n\nPictureProvider? assetPictureProvider(String assetName, String? package) =>\n ExactAssetPicture(SvgPicture.svgStringDecoder, assetName, package: package);\n\nPictureProvider? memoryPictureProvider(Uint8List bytes) =>\n MemoryPicture(SvgPicture.svgByteDecoder, bytes);\n\nPictureProvider? networkPictureProvider(String url) =>\n NetworkPicture(SvgPicture.svgByteDecoder, url);\n\nPictureProvider? filePictureProvider(String path) =>\n FilePicture(SvgPicture.svgByteDecoder, File(path));\n\nWidget? svgPictureString(String bytes) => SvgPicture.string(bytes);\n","avg_line_length":34.45,"max_line_length":80,"alphanum_fraction":0.7997097242} {"size":29456,"ext":"dart","lang":"Dart","max_stars_count":3.0,"content":"\/\/ Copyright 2014 The Flutter Authors. All rights reserved.\n\/\/ Use of this source code is governed by a BSD-style license that can be\n\/\/ found in the LICENSE file.\n\nimport 'dart:ui' as ui;\nimport 'dart:ui' show PointerChange;\n\nimport 'package:flutter\/gestures.dart';\nimport 'package:flutter\/rendering.dart';\nimport 'package:flutter_test\/flutter_test.dart';\n\nimport 'mouse_tracker_test_utils.dart';\n\nMouseTracker get _mouseTracker => RendererBinding.instance.mouseTracker;\n\ntypedef SimpleAnnotationFinder = Iterable Function(Offset offset);\n\nvoid main() {\n final TestMouseTrackerFlutterBinding binding = TestMouseTrackerFlutterBinding();\n void _setUpMouseAnnotationFinder(SimpleAnnotationFinder annotationFinder) {\n binding.setHitTest((BoxHitTestResult result, Offset position) {\n for (final TestAnnotationEntry entry in annotationFinder(position)) {\n result.addWithRawTransform(\n transform: entry.transform,\n position: position,\n hitTest: (BoxHitTestResult result, Offset position) {\n result.add(entry);\n return true;\n },\n );\n }\n return true;\n });\n }\n\n \/\/ Set up a trivial test environment that includes one annotation.\n \/\/ This annotation records the enter, hover, and exit events it receives to\n \/\/ `logEvents`.\n \/\/ This annotation also contains a cursor with a value of `testCursor`.\n \/\/ The mouse tracker records the cursor requests it receives to `logCursors`.\n TestAnnotationTarget _setUpWithOneAnnotation({\n required List logEvents,\n }) {\n final TestAnnotationTarget oneAnnotation = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) {\n if (logEvents != null)\n logEvents.add(event);\n },\n onHover: (PointerHoverEvent event) {\n if (logEvents != null)\n logEvents.add(event);\n },\n onExit: (PointerExitEvent event) {\n if (logEvents != null)\n logEvents.add(event);\n },\n );\n _setUpMouseAnnotationFinder(\n (Offset position) sync* {\n yield TestAnnotationEntry(oneAnnotation);\n },\n );\n return oneAnnotation;\n }\n\n void dispatchRemoveDevice([int device = 0]) {\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.remove, Offset.zero, device: device),\n ]));\n }\n\n setUp(() {\n binding.postFrameCallbacks.clear();\n });\n\n final Matrix4 translate10by20 = Matrix4.translationValues(10, 20, 0);\n\n test('should detect enter, hover, and exit from Added, Hover, and Removed events', () {\n final List events = [];\n _setUpWithOneAnnotation(logEvents: events);\n\n final List listenerLogs = [];\n _mouseTracker.addListener(() {\n listenerLogs.add(_mouseTracker.mouseIsConnected);\n });\n\n expect(_mouseTracker.mouseIsConnected, isFalse);\n\n \/\/ Pointer enters the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, Offset.zero),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent()),\n ]));\n expect(listenerLogs, [true]);\n events.clear();\n listenerLogs.clear();\n\n \/\/ Pointer hovers the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(1.0, 101.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerHoverEvent(position: Offset(1.0, 101.0))),\n ]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n expect(listenerLogs, isEmpty);\n events.clear();\n\n \/\/ Pointer is removed while on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.remove, const Offset(1.0, 101.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerExitEvent(position: Offset(1.0, 101.0))),\n ]));\n expect(listenerLogs, [false]);\n events.clear();\n listenerLogs.clear();\n\n \/\/ Pointer is added on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 301.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent(position: Offset(0.0, 301.0))),\n ]));\n expect(listenerLogs, [true]);\n events.clear();\n listenerLogs.clear();\n });\n\n test('should correctly handle multiple devices', () {\n final List events = [];\n _setUpWithOneAnnotation(logEvents: events);\n\n expect(_mouseTracker.mouseIsConnected, isFalse);\n\n \/\/ The first mouse is added on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, Offset.zero),\n _pointerData(PointerChange.hover, const Offset(0.0, 1.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent()),\n EventMatcher(const PointerHoverEvent(position: Offset(0.0, 1.0))),\n ]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n events.clear();\n\n \/\/ The second mouse is added on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 401.0), device: 1),\n _pointerData(PointerChange.hover, const Offset(1.0, 401.0), device: 1),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent(position: Offset(0.0, 401.0), device: 1)),\n EventMatcher(const PointerHoverEvent(position: Offset(1.0, 401.0), device: 1)),\n ]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n events.clear();\n\n \/\/ The first mouse moves on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(0.0, 101.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerHoverEvent(position: Offset(0.0, 101.0))),\n ]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n events.clear();\n\n \/\/ The second mouse moves on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(1.0, 501.0), device: 1),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerHoverEvent(position: Offset(1.0, 501.0), device: 1)),\n ]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n events.clear();\n\n \/\/ The first mouse is removed while on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.remove, const Offset(0.0, 101.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerExitEvent(position: Offset(0.0, 101.0))),\n ]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n events.clear();\n\n \/\/ The second mouse still moves on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(1.0, 601.0), device: 1),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerHoverEvent(position: Offset(1.0, 601.0), device: 1)),\n ]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n events.clear();\n\n \/\/ The second mouse is removed while on the annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.remove, const Offset(1.0, 601.0), device: 1),\n ]));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerExitEvent(position: Offset(1.0, 601.0), device: 1)),\n ]));\n expect(_mouseTracker.mouseIsConnected, isFalse);\n events.clear();\n });\n\n test('should not handle non-hover events', () {\n final List events = [];\n _setUpWithOneAnnotation(logEvents: events);\n\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 101.0)),\n _pointerData(PointerChange.down, const Offset(0.0, 101.0)),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n expect(events, _equalToEventsOnCriticalFields([\n \/\/ This Enter event is triggered by the [PointerAddedEvent] The\n \/\/ [PointerDownEvent] is ignored by [MouseTracker].\n EventMatcher(const PointerEnterEvent(position: Offset(0.0, 101.0))),\n ]));\n events.clear();\n\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.move, const Offset(0.0, 201.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([]));\n events.clear();\n\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.up, const Offset(0.0, 301.0)),\n ]));\n expect(events, _equalToEventsOnCriticalFields([]));\n events.clear();\n });\n\n test('should correctly handle when the annotation appears or disappears on the pointer', () {\n late bool isInHitRegion;\n final List events = [];\n final TestAnnotationTarget annotation = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => events.add(event),\n onHover: (PointerHoverEvent event) => events.add(event),\n onExit: (PointerExitEvent event) => events.add(event),\n );\n _setUpMouseAnnotationFinder((Offset position) sync* {\n if (isInHitRegion) {\n yield TestAnnotationEntry(annotation, Matrix4.translationValues(10, 20, 0));\n }\n });\n\n isInHitRegion = false;\n\n \/\/ Connect a mouse when there is no annotation.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 100.0)),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n expect(events, _equalToEventsOnCriticalFields([]));\n expect(_mouseTracker.mouseIsConnected, isTrue);\n events.clear();\n\n \/\/ Adding an annotation should trigger Enter event.\n isInHitRegion = true;\n binding.scheduleMouseTrackerPostFrameCheck();\n expect(binding.postFrameCallbacks, hasLength(1));\n\n binding.flushPostFrameCallbacks(Duration.zero);\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent(position: Offset(0, 100)).transformed(translate10by20)),\n ]));\n events.clear();\n\n \/\/ Removing an annotation should trigger events.\n isInHitRegion = false;\n binding.scheduleMouseTrackerPostFrameCheck();\n expect(binding.postFrameCallbacks, hasLength(1));\n\n binding.flushPostFrameCallbacks(Duration.zero);\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerExitEvent(position: Offset(0.0, 100.0)).transformed(translate10by20)),\n ]));\n expect(binding.postFrameCallbacks, hasLength(0));\n });\n\n test('should correctly handle when the annotation moves in or out of the pointer', () {\n late bool isInHitRegion;\n final List events = [];\n final TestAnnotationTarget annotation = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => events.add(event),\n onHover: (PointerHoverEvent event) => events.add(event),\n onExit: (PointerExitEvent event) => events.add(event),\n );\n _setUpMouseAnnotationFinder((Offset position) sync* {\n if (isInHitRegion) {\n yield TestAnnotationEntry(annotation, Matrix4.translationValues(10, 20, 0));\n }\n });\n\n isInHitRegion = false;\n\n \/\/ Connect a mouse.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 100.0)),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n events.clear();\n\n \/\/ During a frame, the annotation moves into the pointer.\n isInHitRegion = true;\n expect(binding.postFrameCallbacks, hasLength(0));\n binding.scheduleMouseTrackerPostFrameCheck();\n expect(binding.postFrameCallbacks, hasLength(1));\n\n binding.flushPostFrameCallbacks(Duration.zero);\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent(position: Offset(0.0, 100.0)).transformed(translate10by20)),\n ]));\n events.clear();\n\n expect(binding.postFrameCallbacks, hasLength(0));\n\n \/\/ During a frame, the annotation moves out of the pointer.\n isInHitRegion = false;\n expect(binding.postFrameCallbacks, hasLength(0));\n binding.scheduleMouseTrackerPostFrameCheck();\n expect(binding.postFrameCallbacks, hasLength(1));\n\n binding.flushPostFrameCallbacks(Duration.zero);\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerExitEvent(position: Offset(0.0, 100.0)).transformed(translate10by20)),\n ]));\n expect(binding.postFrameCallbacks, hasLength(0));\n });\n\n test('should correctly handle when the pointer is added or removed on the annotation', () {\n late bool isInHitRegion;\n final List events = [];\n final TestAnnotationTarget annotation = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => events.add(event),\n onHover: (PointerHoverEvent event) => events.add(event),\n onExit: (PointerExitEvent event) => events.add(event),\n );\n _setUpMouseAnnotationFinder((Offset position) sync* {\n if (isInHitRegion) {\n yield TestAnnotationEntry(annotation, Matrix4.translationValues(10, 20, 0));\n }\n });\n\n isInHitRegion = false;\n\n \/\/ Connect a mouse in the region. Should trigger Enter.\n isInHitRegion = true;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 100.0)),\n ]));\n\n expect(binding.postFrameCallbacks, hasLength(0));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent(position: Offset(0.0, 100.0)).transformed(translate10by20)),\n ]));\n events.clear();\n\n \/\/ Disconnect the mouse from the region. Should trigger Exit.\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.remove, const Offset(0.0, 100.0)),\n ]));\n expect(binding.postFrameCallbacks, hasLength(0));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerExitEvent(position: Offset(0.0, 100.0)).transformed(translate10by20)),\n ]));\n });\n\n test('should correctly handle when the pointer moves in or out of the annotation', () {\n late bool isInHitRegion;\n final List events = [];\n final TestAnnotationTarget annotation = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => events.add(event),\n onHover: (PointerHoverEvent event) => events.add(event),\n onExit: (PointerExitEvent event) => events.add(event),\n );\n _setUpMouseAnnotationFinder((Offset position) sync* {\n if (isInHitRegion) {\n yield TestAnnotationEntry(annotation, Matrix4.translationValues(10, 20, 0));\n }\n });\n\n isInHitRegion = false;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(200.0, 100.0)),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n\n expect(binding.postFrameCallbacks, hasLength(0));\n events.clear();\n\n \/\/ Moves the mouse into the region. Should trigger Enter.\n isInHitRegion = true;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(0.0, 100.0)),\n ]));\n expect(binding.postFrameCallbacks, hasLength(0));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerEnterEvent(position: Offset(0.0, 100.0)).transformed(translate10by20)),\n EventMatcher(const PointerHoverEvent(position: Offset(0.0, 100.0)).transformed(translate10by20)),\n ]));\n events.clear();\n\n \/\/ Moves the mouse out of the region. Should trigger Exit.\n isInHitRegion = false;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(200.0, 100.0)),\n ]));\n expect(binding.postFrameCallbacks, hasLength(0));\n expect(events, _equalToEventsOnCriticalFields([\n EventMatcher(const PointerExitEvent(position: Offset(200.0, 100.0)).transformed(translate10by20)),\n ]));\n });\n\n test('should not schedule post-frame callbacks when no mouse is connected', () {\n _setUpMouseAnnotationFinder((Offset position) sync* {\n });\n\n \/\/ Connect a touch device, which should not be recognized by MouseTracker\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 100.0), kind: PointerDeviceKind.touch),\n ]));\n expect(_mouseTracker.mouseIsConnected, isFalse);\n\n expect(binding.postFrameCallbacks, hasLength(0));\n });\n\n test('should not flip out if not all mouse events are listened to', () {\n bool isInHitRegionOne = true;\n bool isInHitRegionTwo = false;\n final TestAnnotationTarget annotation1 = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) {},\n );\n final TestAnnotationTarget annotation2 = TestAnnotationTarget(\n onExit: (PointerExitEvent event) {},\n );\n _setUpMouseAnnotationFinder((Offset position) sync* {\n if (isInHitRegionOne)\n yield TestAnnotationEntry(annotation1);\n else if (isInHitRegionTwo)\n yield TestAnnotationEntry(annotation2);\n });\n\n isInHitRegionOne = false;\n isInHitRegionTwo = true;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 101.0)),\n _pointerData(PointerChange.hover, const Offset(1.0, 101.0)),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n\n \/\/ Passes if no errors are thrown.\n });\n\n test('should trigger callbacks between parents and children in correct order', () {\n \/\/ This test simulates the scenario of a layer being the child of another.\n \/\/\n \/\/ \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n \/\/ |A |\n \/\/ | \u2014\u2014\u2014\u2014\u2014\u2014 |\n \/\/ | |B | |\n \/\/ | \u2014\u2014\u2014\u2014\u2014\u2014 |\n \/\/ \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\n late bool isInB;\n final List logs = [];\n final TestAnnotationTarget annotationA = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => logs.add('enterA'),\n onExit: (PointerExitEvent event) => logs.add('exitA'),\n onHover: (PointerHoverEvent event) => logs.add('hoverA'),\n );\n final TestAnnotationTarget annotationB = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => logs.add('enterB'),\n onExit: (PointerExitEvent event) => logs.add('exitB'),\n onHover: (PointerHoverEvent event) => logs.add('hoverB'),\n );\n _setUpMouseAnnotationFinder((Offset position) sync* {\n \/\/ Children's annotations come before parents'.\n if (isInB) {\n yield TestAnnotationEntry(annotationB);\n yield TestAnnotationEntry(annotationA);\n }\n });\n\n \/\/ Starts out of A.\n isInB = false;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 1.0)),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n expect(logs, []);\n\n \/\/ Moves into B within one frame.\n isInB = true;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(0.0, 10.0)),\n ]));\n expect(logs, ['enterA', 'enterB', 'hoverB', 'hoverA']);\n logs.clear();\n\n \/\/ Moves out of A within one frame.\n isInB = false;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(0.0, 20.0)),\n ]));\n expect(logs, ['exitB', 'exitA']);\n });\n\n test('should trigger callbacks between disjoint siblings in correctly order', () {\n \/\/ This test simulates the scenario of 2 sibling layers that do not overlap\n \/\/ with each other.\n \/\/\n \/\/ \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n \/\/ |A | |B |\n \/\/ | | | |\n \/\/ \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\n late bool isInA;\n late bool isInB;\n final List logs = [];\n final TestAnnotationTarget annotationA = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => logs.add('enterA'),\n onExit: (PointerExitEvent event) => logs.add('exitA'),\n onHover: (PointerHoverEvent event) => logs.add('hoverA'),\n );\n final TestAnnotationTarget annotationB = TestAnnotationTarget(\n onEnter: (PointerEnterEvent event) => logs.add('enterB'),\n onExit: (PointerExitEvent event) => logs.add('exitB'),\n onHover: (PointerHoverEvent event) => logs.add('hoverB'),\n );\n _setUpMouseAnnotationFinder((Offset position) sync* {\n if (isInA) {\n yield TestAnnotationEntry(annotationA);\n } else if (isInB) {\n yield TestAnnotationEntry(annotationB);\n }\n });\n\n \/\/ Starts within A.\n isInA = true;\n isInB = false;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.add, const Offset(0.0, 1.0)),\n ]));\n addTearDown(() => dispatchRemoveDevice());\n expect(logs, ['enterA']);\n logs.clear();\n\n \/\/ Moves into B within one frame.\n isInA = false;\n isInB = true;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(0.0, 10.0)),\n ]));\n expect(logs, ['exitA', 'enterB', 'hoverB']);\n logs.clear();\n\n \/\/ Moves into A within one frame.\n isInA = true;\n isInB = false;\n RendererBinding.instance.platformDispatcher.onPointerDataPacket!(ui.PointerDataPacket(data: [\n _pointerData(PointerChange.hover, const Offset(0.0, 1.0)),\n ]));\n expect(logs, ['exitB', 'enterA', 'hoverA']);\n });\n}\n\nui.PointerData _pointerData(\n PointerChange change,\n Offset logicalPosition, {\n int device = 0,\n PointerDeviceKind kind = PointerDeviceKind.mouse,\n}) {\n return ui.PointerData(\n change: change,\n physicalX: logicalPosition.dx * RendererBinding.instance.window.devicePixelRatio,\n physicalY: logicalPosition.dy * RendererBinding.instance.window.devicePixelRatio,\n kind: kind,\n device: device,\n );\n}\n\nclass BaseEventMatcher extends Matcher {\n BaseEventMatcher(this.expected)\n : assert(expected != null);\n\n final PointerEvent expected;\n\n bool _matchesField(Map matchState, String field, dynamic actual, dynamic expected) {\n if (actual != expected) {\n addStateInfo(matchState, {\n 'field': field,\n 'expected': expected,\n 'actual': actual,\n });\n return false;\n }\n return true;\n }\n\n @override\n bool matches(dynamic untypedItem, Map matchState) {\n final PointerEvent actual = untypedItem as PointerEvent;\n if (!(\n _matchesField(matchState, 'kind', actual.kind, PointerDeviceKind.mouse) &&\n _matchesField(matchState, 'position', actual.position, expected.position) &&\n _matchesField(matchState, 'device', actual.device, expected.device) &&\n _matchesField(matchState, 'localPosition', actual.localPosition, expected.localPosition)\n )) {\n return false;\n }\n return true;\n }\n\n @override\n Description describe(Description description) {\n return description\n .add('event (critical fields only) ')\n .addDescriptionOf(expected);\n }\n\n @override\n Description describeMismatch(\n dynamic item,\n Description mismatchDescription,\n Map matchState,\n bool verbose,\n ) {\n return mismatchDescription\n .add('has ')\n .addDescriptionOf(matchState['actual'])\n .add(\" at field `${matchState['field']}`, which doesn't match the expected \")\n .addDescriptionOf(matchState['expected']);\n }\n}\n\nclass EventMatcher extends BaseEventMatcher {\n EventMatcher(T super.expected);\n\n @override\n bool matches(dynamic untypedItem, Map matchState) {\n if (untypedItem is! T) {\n return false;\n }\n\n return super.matches(untypedItem, matchState);\n }\n\n @override\n Description describeMismatch(\n dynamic item,\n Description mismatchDescription,\n Map matchState,\n bool verbose,\n ) {\n if (item is! T) {\n return mismatchDescription\n .add('is ')\n .addDescriptionOf(item.runtimeType)\n .add(' and is not a subtype of ')\n .addDescriptionOf(T);\n }\n return super.describeMismatch(item, mismatchDescription, matchState, verbose);\n }\n}\n\nclass _EventListCriticalFieldsMatcher extends Matcher {\n _EventListCriticalFieldsMatcher(this._expected);\n\n final Iterable _expected;\n\n @override\n bool matches(dynamic untypedItem, Map matchState) {\n if (untypedItem is! Iterable)\n return false;\n final Iterable item = untypedItem;\n final Iterator iterator = item.iterator;\n if (item.length != _expected.length)\n return false;\n int i = 0;\n for (final BaseEventMatcher matcher in _expected) {\n iterator.moveNext();\n final Map subState = {};\n final PointerEvent actual = iterator.current;\n if (!matcher.matches(actual, subState)) {\n addStateInfo(matchState, {\n 'index': i,\n 'expected': matcher.expected,\n 'actual': actual,\n 'matcher': matcher,\n 'state': subState,\n });\n return false;\n }\n i++;\n }\n return true;\n }\n\n @override\n Description describe(Description description) {\n return description\n .add('event list (critical fields only) ')\n .addDescriptionOf(_expected);\n }\n\n @override\n Description describeMismatch(\n dynamic item,\n Description mismatchDescription,\n Map matchState,\n bool verbose,\n ) {\n if (item is! Iterable) {\n return mismatchDescription\n .add('is type ${item.runtimeType} instead of Iterable');\n } else if (item.length != _expected.length) {\n return mismatchDescription\n .add('has length ${item.length} instead of ${_expected.length}');\n } else if (matchState['matcher'] == null) {\n return mismatchDescription\n .add('met unexpected fatal error');\n } else {\n mismatchDescription\n .add('has\\n ')\n .addDescriptionOf(matchState['actual'])\n .add(\"\\nat index ${matchState['index']}, which doesn't match\\n \")\n .addDescriptionOf(matchState['expected'])\n .add('\\nsince it ');\n final Description subDescription = StringDescription();\n final Matcher matcher = matchState['matcher'] as Matcher;\n matcher.describeMismatch(\n matchState['actual'],\n subDescription,\n matchState['state'] as Map,\n verbose,\n );\n mismatchDescription.add(subDescription.toString());\n return mismatchDescription;\n }\n }\n}\n\nMatcher _equalToEventsOnCriticalFields(List source) {\n return _EventListCriticalFieldsMatcher(source);\n}\n","avg_line_length":38.7578947368,"max_line_length":122,"alphanum_fraction":0.6998574144} {"size":17208,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\nimport 'package:dartdoc\/src\/model\/model.dart';\n\ntypedef ContainerSidebar = String Function(\n Container, TemplateDataWithContainer);\ntypedef LibrarySidebar = String Function(Library, TemplateDataWithLibrary);\n\nabstract class TemplateOptions {\n String? get relCanonicalPrefix;\n String get toolVersion;\n bool get useBaseHref;\n String get customHeaderContent;\n String get customFooterContent;\n String get customInnerFooterText;\n}\n\nabstract class TemplateDataBase {\n final PackageGraph _packageGraph;\n final TemplateOptions htmlOptions;\n\n TemplateDataBase(this.htmlOptions, this._packageGraph);\n\n String get title;\n\n String get layoutTitle;\n\n String get metaDescription;\n\n String get version => htmlOptions.toolVersion;\n\n String? get relCanonicalPrefix => htmlOptions.relCanonicalPrefix;\n\n bool get useBaseHref => htmlOptions.useBaseHref;\n\n String get customHeader => htmlOptions.customHeaderContent;\n\n String get customFooter => htmlOptions.customFooterContent;\n\n String get customInnerFooter => htmlOptions.customInnerFooterText;\n\n List get localPackages => _packageGraph.localPackages;\n\n Package get defaultPackage => _packageGraph.defaultPackage;\n\n bool get hasFooterVersion => _packageGraph.hasFooterVersion;\n\n bool get includeVersion => false;\n\n List get navLinks;\n List get navLinksWithGenerics => [];\n Documentable? get parent {\n if (navLinksWithGenerics.isEmpty) {\n return navLinks.isNotEmpty ? navLinks.last : null;\n }\n return navLinksWithGenerics.last;\n }\n\n bool get hasHomepage => false;\n\n String? get homepage => null;\n\n Documentable get self;\n\n String get htmlBase;\n\n String get bareHref {\n if (self is Indexable) {\n var selfHref = (self as Indexable).href ?? '';\n return selfHref.replaceAll(htmlBasePlaceholder, '');\n }\n return '';\n }\n}\n\nabstract class TemplateData extends TemplateDataBase {\n TemplateData(TemplateOptions htmlOptions, PackageGraph packageGraph)\n : super(htmlOptions, packageGraph);\n\n @override\n T get self;\n\n String _layoutTitle(String name, String kind, bool isDeprecated) =>\n _packageGraph.rendererFactory.templateRenderer\n .composeLayoutTitle(name, kind, isDeprecated);\n}\n\n\/\/\/ A [TemplateData] which contains a library, for rendering the\n\/\/\/ sidebar-for-library.\nabstract class TemplateDataWithLibrary\n implements TemplateData {\n Library get library;\n}\n\n\/\/\/ A [TemplateData] which contains a container, for rendering the\n\/\/\/ sidebar-for-container.\nabstract class TemplateDataWithContainer\n implements TemplateData {\n Container get container;\n}\n\nclass PackageTemplateData extends TemplateData {\n final Package package;\n PackageTemplateData(\n TemplateOptions htmlOptions, PackageGraph packageGraph, this.package)\n : super(htmlOptions, packageGraph);\n\n @override\n bool get includeVersion => true;\n @override\n List get navLinks => [];\n @override\n String get title => '${package.name} - Dart API docs';\n @override\n Package get self => package;\n @override\n String get layoutTitle => _layoutTitle(package.name, package.kind, false);\n @override\n String get metaDescription =>\n '${package.name} API docs, for the Dart programming language.';\n\n @override\n bool get hasHomepage => package.hasHomepage;\n @override\n String get homepage => package.homepage;\n\n \/\/\/ empty for packages because they are at the root \u2013 not needed\n @override\n String get htmlBase => '';\n}\n\nclass CategoryTemplateData extends TemplateData {\n final Category category;\n\n CategoryTemplateData(\n TemplateOptions htmlOptions, PackageGraph packageGraph, this.category)\n : super(htmlOptions, packageGraph);\n\n @override\n String get title => '${category.name} ${category.kind} - Dart API';\n\n @override\n String get htmlBase => '..\/';\n\n @override\n String get layoutTitle => _layoutTitle(category.name, category.kind, false);\n\n @override\n String get metaDescription =>\n '${category.name} ${category.kind} docs, for the Dart programming language.';\n\n @override\n List get navLinks => [category.package];\n\n @override\n Category get self => category;\n}\n\nclass LibraryTemplateData extends TemplateData\n implements TemplateDataWithLibrary {\n @override\n final Library library;\n final LibrarySidebar _sidebarForLibrary;\n\n LibraryTemplateData(TemplateOptions htmlOptions, PackageGraph packageGraph,\n this.library, this._sidebarForLibrary)\n : super(htmlOptions, packageGraph);\n\n String get sidebarForLibrary => _sidebarForLibrary(library, this);\n @override\n String get title => '${library.name} library - Dart API';\n @override\n String get htmlBase => '..\/';\n @override\n String get metaDescription =>\n '${library.name} library API docs, for the Dart programming language.';\n @override\n List get navLinks => [_packageGraph.defaultPackage];\n\n @override\n String get layoutTitle =>\n _layoutTitle(library.name, 'library', library.isDeprecated);\n\n @override\n Library get self => library;\n}\n\n\/\/\/ Template data for Dart 2.1-style mixin declarations.\nclass MixinTemplateData extends InheritingContainerTemplateData {\n MixinTemplateData(\n TemplateOptions htmlOptions,\n PackageGraph packageGraph,\n Library library,\n Mixin mixin,\n LibrarySidebar _sidebarForLibrary,\n ContainerSidebar _sidebarForContainer)\n : super(htmlOptions, packageGraph, library, mixin, _sidebarForLibrary,\n _sidebarForContainer);\n\n Mixin get mixin => clazz;\n\n @override\n Mixin get self => mixin;\n}\n\n\/\/\/ Template data for Dart classes.\nclass ClassTemplateData extends InheritingContainerTemplateData {\n ClassTemplateData(\n TemplateOptions htmlOptions,\n PackageGraph packageGraph,\n Library library,\n Class clazz,\n LibrarySidebar _sidebarForLibrary,\n ContainerSidebar _sidebarForContainer)\n : super(htmlOptions, packageGraph, library, clazz, _sidebarForLibrary,\n _sidebarForContainer);\n\n @override\n Class get clazz => super.clazz;\n}\n\n\/\/\/ Base template data class for [Class], [Enum], and [Mixin].\nabstract class InheritingContainerTemplateData\n extends TemplateData\n implements TemplateDataWithLibrary, TemplateDataWithContainer {\n final T clazz;\n @override\n final Library library;\n final LibrarySidebar _sidebarForLibrary;\n final ContainerSidebar _sidebarForContainer;\n\n InheritingContainerTemplateData(\n TemplateOptions htmlOptions,\n PackageGraph packageGraph,\n this.library,\n this.clazz,\n this._sidebarForLibrary,\n this._sidebarForContainer)\n : super(htmlOptions, packageGraph);\n\n String get sidebarForLibrary => _sidebarForLibrary(library, this);\n String get sidebarForContainer => _sidebarForContainer(container, this);\n\n @override\n Container get container => clazz;\n\n @override\n T get self => clazz;\n\n @override\n String get title =>\n '${clazz.name} ${clazz.kind} - ${library.name} library - Dart API';\n @override\n String get metaDescription =>\n 'API docs for the ${clazz.name} ${clazz.kind} from the '\n '${library.name} library, for the Dart programming language.';\n\n @override\n String get layoutTitle => _layoutTitle(\n clazz.nameWithLinkedGenerics, clazz.fullkind, clazz.isDeprecated);\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n String get htmlBase => '..\/';\n}\n\n\/\/\/ Base template data class for [Extension].\nclass ExtensionTemplateData extends TemplateData\n implements TemplateDataWithLibrary, TemplateDataWithContainer {\n final T extension;\n @override\n final Library library;\n final ContainerSidebar _sidebarForContainer;\n final LibrarySidebar _sidebarForLibrary;\n\n ExtensionTemplateData(\n TemplateOptions htmlOptions,\n PackageGraph packageGraph,\n this.library,\n this.extension,\n this._sidebarForLibrary,\n this._sidebarForContainer)\n : super(htmlOptions, packageGraph);\n\n String get sidebarForContainer => _sidebarForContainer(container, this);\n String get sidebarForLibrary => _sidebarForLibrary(library, this);\n\n @override\n Container get container => extension;\n\n @override\n T get self => extension;\n\n @override\n String get title =>\n '${extension.name} ${extension.kind} - ${library.name} library - Dart API';\n @override\n String get metaDescription =>\n 'API docs for the ${extension.name} ${extension.kind} from the '\n '${library.name} library, for the Dart programming language.';\n\n @override\n String get layoutTitle => _layoutTitle(extension.name, extension.kind, false);\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n String get htmlBase => '..\/';\n}\n\nclass ConstructorTemplateData extends TemplateData\n implements\n TemplateDataWithLibrary,\n TemplateDataWithContainer {\n @override\n final Library library;\n final Constructable constructable;\n final Constructor constructor;\n final ContainerSidebar _sidebarForContainer;\n\n ConstructorTemplateData(\n TemplateOptions htmlOptions,\n PackageGraph packageGraph,\n this.library,\n this.constructable,\n this.constructor,\n this._sidebarForContainer)\n : super(htmlOptions, packageGraph);\n\n String get sidebarForContainer => _sidebarForContainer(container, this);\n\n @override\n Container get container => constructable;\n @override\n Constructor get self => constructor;\n @override\n String get layoutTitle => _layoutTitle(\n constructor.name, constructor.fullKind, constructor.isDeprecated);\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n List get navLinksWithGenerics => [constructable];\n @override\n @override\n String get htmlBase => '..\/..\/';\n @override\n String get title =>\n '${constructor.name} constructor - ${constructable.name} - '\n '${library.name} library - Dart API';\n @override\n String get metaDescription =>\n 'API docs for the ${constructor.name} constructor from $constructable '\n 'from the ${library.name} library, for the Dart programming language.';\n}\n\nclass EnumTemplateData extends InheritingContainerTemplateData {\n EnumTemplateData(\n TemplateOptions htmlOptions,\n PackageGraph packageGraph,\n Library library,\n Enum eNum,\n LibrarySidebar _sidebarForLibrary,\n ContainerSidebar _sidebarForContainer)\n : super(htmlOptions, packageGraph, library, eNum, _sidebarForLibrary,\n _sidebarForContainer);\n\n Enum get eNum => clazz;\n @override\n Enum get self => eNum;\n}\n\nclass FunctionTemplateData extends TemplateData\n implements TemplateDataWithLibrary {\n final ModelFunction function;\n @override\n final Library library;\n final LibrarySidebar _sidebarForLibrary;\n\n FunctionTemplateData(TemplateOptions htmlOptions, PackageGraph packageGraph,\n this.library, this.function, this._sidebarForLibrary)\n : super(htmlOptions, packageGraph);\n\n String get sidebarForLibrary => _sidebarForLibrary(library, this);\n\n @override\n ModelFunction get self => function;\n @override\n String get title =>\n '${function.name} function - ${library.name} library - Dart API';\n @override\n String get layoutTitle => _layoutTitle(\n function.nameWithGenerics, 'function', function.isDeprecated);\n @override\n String get metaDescription =>\n 'API docs for the ${function.name} function from the '\n '${library.name} library, for the Dart programming language.';\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n String get htmlBase => '..\/';\n}\n\nclass MethodTemplateData extends TemplateData\n implements\n TemplateDataWithLibrary,\n TemplateDataWithContainer {\n @override\n final Library library;\n final Method method;\n @override\n final Container container;\n final ContainerSidebar _sidebarForContainer;\n\n final String _containerDescription;\n\n MethodTemplateData(TemplateOptions htmlOptions, PackageGraph packageGraph,\n this.library, this.container, this.method, this._sidebarForContainer)\n : _containerDescription = container.isClass ? 'class' : 'extension',\n super(htmlOptions, packageGraph);\n\n String get sidebarForContainer => _sidebarForContainer(container, this);\n\n @override\n Method get self => method;\n @override\n String get title =>\n '${method.name} method - ${container.name} $_containerDescription - '\n '${library.name} library - Dart API';\n @override\n String get layoutTitle => _layoutTitle(\n method.nameWithGenerics, method.fullkind, method.isDeprecated);\n @override\n String get metaDescription =>\n 'API docs for the ${method.name} method from the '\n '${container.name} $_containerDescription, '\n 'for the Dart programming language.';\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n List get navLinksWithGenerics => [container];\n @override\n String get htmlBase => '..\/..\/';\n}\n\nclass PropertyTemplateData extends TemplateData\n implements\n TemplateDataWithLibrary,\n TemplateDataWithContainer {\n @override\n final Library library;\n @override\n final Container container;\n final Field property;\n final ContainerSidebar _sidebarForContainer;\n final String _containerDescription;\n\n PropertyTemplateData(TemplateOptions htmlOptions, PackageGraph packageGraph,\n this.library, this.container, this.property, this._sidebarForContainer)\n : _containerDescription = container.isClass ? 'class' : 'extension',\n super(htmlOptions, packageGraph);\n\n String get sidebarForContainer => _sidebarForContainer(container, this);\n\n @override\n Field get self => property;\n\n @override\n String get title => '${property.name} ${property.kind} - '\n '${container.name} $_containerDescription - '\n '${library.name} library - Dart API';\n @override\n String get layoutTitle =>\n _layoutTitle(property.name, property.fullkind, property.isDeprecated);\n @override\n String get metaDescription =>\n 'API docs for the ${property.name} ${property.kind} from the '\n '${container.name} $_containerDescription, '\n 'for the Dart programming language.';\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n List get navLinksWithGenerics => [container];\n @override\n String get htmlBase => '..\/..\/';\n}\n\nclass TypedefTemplateData extends TemplateData\n implements TemplateDataWithLibrary {\n @override\n final Library library;\n final Typedef typeDef;\n final LibrarySidebar _sidebarForLibrary;\n\n TypedefTemplateData(TemplateOptions htmlOptions, PackageGraph packageGraph,\n this.library, this.typeDef, this._sidebarForLibrary)\n : super(htmlOptions, packageGraph);\n\n String get sidebarForLibrary => _sidebarForLibrary(library, this);\n\n @override\n Typedef get self => typeDef;\n\n @override\n String get title =>\n '${typeDef.name} typedef - ${library.name} library - Dart API';\n @override\n String get layoutTitle =>\n _layoutTitle(typeDef.nameWithGenerics, 'typedef', typeDef.isDeprecated);\n @override\n String get metaDescription =>\n 'API docs for the ${typeDef.name} property from the '\n '${library.name} library, for the Dart programming language.';\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n String get htmlBase => '..\/';\n}\n\nclass TopLevelPropertyTemplateData extends TemplateData\n implements TemplateDataWithLibrary {\n @override\n final Library library;\n final TopLevelVariable property;\n final LibrarySidebar _sidebarForLibrary;\n\n TopLevelPropertyTemplateData(\n TemplateOptions htmlOptions,\n PackageGraph packageGraph,\n this.library,\n this.property,\n this._sidebarForLibrary)\n : super(htmlOptions, packageGraph);\n\n String get sidebarForLibrary => _sidebarForLibrary(library, this);\n\n @override\n TopLevelVariable get self => property;\n\n @override\n String get title =>\n '${property.name} $_type - ${library.name} library - Dart API';\n @override\n String get layoutTitle =>\n _layoutTitle(property.name, _type, property.isDeprecated);\n @override\n String get metaDescription =>\n 'API docs for the ${property.name} $_type from the '\n '${library.name} library, for the Dart programming language.';\n @override\n List get navLinks => [_packageGraph.defaultPackage, library];\n @override\n String get htmlBase => '..\/';\n\n String get _type => property.isConst ? 'constant' : 'property';\n}\n","avg_line_length":30.8940754039,"max_line_length":83,"alphanum_fraction":0.7341352859} {"size":1376,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"part of '..\/ast.dart';\n\n\/\/\/ A \"CREATE TABLE\" statement, see https:\/\/www.sqlite.org\/lang_createtable.html\n\/\/\/ for the individual components.\nclass CreateTableStatement extends Statement\n with SchemaStatement\n implements PartOfMoorFile {\n final bool ifNotExists;\n final String tableName;\n final List columns;\n final List tableConstraints;\n final bool withoutRowId;\n\n \/\/\/ Specific to moor. Overrides the name of the data class used to hold a\n \/\/\/ result for of this table. Will be null when the moor extensions are not\n \/\/\/ enabled or if no name has been set.\n final String overriddenDataClassName;\n\n Token openingBracket;\n Token closingBracket;\n\n CreateTableStatement(\n {this.ifNotExists = false,\n @required this.tableName,\n this.columns = const [],\n this.tableConstraints = const [],\n this.withoutRowId = false,\n this.overriddenDataClassName});\n\n @override\n T accept(AstVisitor visitor) => visitor.visitCreateTableStatement(this);\n\n @override\n Iterable get childNodes => [...columns, ...tableConstraints];\n\n @override\n bool contentEquals(CreateTableStatement other) {\n return other.ifNotExists == ifNotExists &&\n other.tableName == tableName &&\n other.withoutRowId == withoutRowId &&\n other.overriddenDataClassName == overriddenDataClassName;\n }\n}\n","avg_line_length":31.2727272727,"max_line_length":80,"alphanum_fraction":0.7216569767} {"size":723,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/*\n * Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file\n * for details. All rights reserved. Use of this source code is governed by a\n * BSD-style license that can be found in the LICENSE file.\n *\/\n\/**\n * @assertion void addEventListener(String type, EventListener listener, [bool useCapture])\n * Register an event handler of a specific event type on the EventTarget.\n * @description Checks that added listener works.\n *\/\nimport \"dart:html\";\nimport \"..\/..\/..\/Utils\/expect.dart\";\n\nconst myType = \"myType\";\n\nmain() {\n Event ev0 = new Event(myType);\n asyncStart();\n window.addEventListener(myType, (Event event) {\n Expect.equals(ev0, event);\n asyncEnd();\n });\n window.dispatchEvent(ev0);\n}\n","avg_line_length":28.92,"max_line_length":91,"alphanum_fraction":0.704011065} {"size":3310,"ext":"dart","lang":"Dart","max_stars_count":795.0,"content":"\/\/ Copyright 2014 Google Inc. All Rights Reserved.\n\/\/\n\/\/ Licensed under the Apache License, Version 2.0 (the \"License\");\n\/\/ you may not use this file except in compliance with the License.\n\/\/ You may obtain a copy of the License at\n\/\/\n\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\/\/\n\/\/ Unless required by applicable law or agreed to in writing, software\n\/\/ distributed under the License is distributed on an \"AS IS\" BASIS,\n\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\/\/ See the License for the specific language governing permissions and\n\/\/ limitations under the License.\n\nlibrary quiver.async.stream_buffer_test;\n\nimport 'package:quiver\/src\/async\/stream_buffer.dart';\nimport 'package:test\/test.dart';\n\nvoid main() {\n group('StreamBuffer', () {\n test('returns orderly overlaps', () {\n StreamBuffer buf = StreamBuffer();\n Stream.fromIterable([\n [1],\n [2, 3, 4],\n [5, 6, 7, 8]\n ]).pipe(buf);\n return Future.wait([buf.read(2), buf.read(4), buf.read(2)]).then((vals) {\n expect(vals[0], equals([1, 2]));\n expect(vals[1], equals([3, 4, 5, 6]));\n expect(vals[2], equals([7, 8]));\n }).then((_) {\n buf.close();\n });\n }, tags: ['fails-on-dartdevc']);\n\n test('respects pausing of stream', () {\n StreamBuffer buf = StreamBuffer()..limit = 2;\n Stream.fromIterable([\n [1],\n [2],\n [3],\n [4]\n ]).pipe(buf);\n return buf.read(2).then((val) {\n expect(val, [1, 2]);\n }).then((_) {\n return buf.read(2);\n }).then((val) {\n expect(val, [3, 4]);\n });\n }, tags: ['fails-on-dartdevc']);\n\n test('throws when reading too much', () {\n StreamBuffer buf = StreamBuffer()..limit = 1;\n Stream.fromIterable([\n [1],\n [2]\n ]).pipe(buf);\n try {\n buf.read(2);\n } catch (e) {\n expect(e, isArgumentError);\n return;\n }\n fail('error not thrown when reading more data than buffer limit');\n });\n\n test('allows patching of streams', () {\n StreamBuffer buf = StreamBuffer();\n Stream.fromIterable([\n [1, 2]\n ]).pipe(buf).then((_) {\n return Stream.fromIterable([\n [3, 4]\n ]).pipe(buf);\n });\n return Future.wait([buf.read(1), buf.read(2), buf.read(1)]).then((vals) {\n expect(vals[0], equals([1]));\n expect(vals[1], equals([2, 3]));\n expect(vals[2], equals([4]));\n });\n });\n\n test('underflows when asked to', () async {\n StreamBuffer buf = StreamBuffer(throwOnError: true);\n Future> futureBytes = buf.read(4);\n Stream.fromIterable([\n [1, 2, 3]\n ]).pipe(buf);\n try {\n List bytes = await futureBytes;\n fail('should not have gotten bytes: $bytes');\n } catch (e) {\n expect(e is UnderflowError, isTrue, reason: '!UnderflowError: $e');\n }\n });\n\n test('accepts several streams', () async {\n StreamBuffer buf = StreamBuffer();\n Stream.fromIterable([\n [1]\n ]).pipe(buf);\n Stream.fromIterable([\n [2, 3, 4, 5]\n ]).pipe(buf);\n final vals = await buf.read(4);\n expect(vals, equals([2, 3, 4, 5]));\n buf.close();\n });\n });\n}\n","avg_line_length":29.0350877193,"max_line_length":79,"alphanum_fraction":0.5519637462} {"size":44316,"ext":"dart","lang":"Dart","max_stars_count":11.0,"content":"\/\/ Copyright 2013 The Flutter Authors. All rights reserved.\n\/\/ Use of this source code is governed by a BSD-style license that can be\n\/\/ found in the LICENSE file.\n\/\/ @dart=2.9\n\nimport 'dart:async';\nimport 'dart:io';\nimport 'dart:typed_data';\nimport 'dart:ui' as ui;\n\nimport 'package:integration_test\/integration_test.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter\/widgets.dart';\nimport 'package:flutter_test\/flutter_test.dart';\nimport 'package:google_maps_flutter\/google_maps_flutter.dart';\n\nimport 'google_map_inspector.dart';\n\nconst LatLng _kInitialMapCenter = LatLng(0, 0);\nconst double _kInitialZoomLevel = 5;\nconst CameraPosition _kInitialCameraPosition =\n CameraPosition(target: _kInitialMapCenter, zoom: _kInitialZoomLevel);\n\nvoid main() {\n IntegrationTestWidgetsFlutterBinding.ensureInitialized();\n\n testWidgets('testCompassToggle', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n compassEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool compassEnabled = await inspector.isCompassEnabled();\n expect(compassEnabled, false);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n compassEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n compassEnabled = await inspector.isCompassEnabled();\n expect(compassEnabled, true);\n });\n\n testWidgets('testMapToolbarToggle', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n mapToolbarEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool mapToolbarEnabled = await inspector.isMapToolbarEnabled();\n expect(mapToolbarEnabled, false);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n mapToolbarEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n mapToolbarEnabled = await inspector.isMapToolbarEnabled();\n expect(mapToolbarEnabled, Platform.isAndroid);\n });\n\n testWidgets('updateMinMaxZoomLevels', (WidgetTester tester) async {\n \/\/ The behaviors of setting min max zoom level on iOS and Android are different.\n \/\/ On iOS, when we get the min or max zoom level after setting the preference, the\n \/\/ min and max will be exactly the same as the value we set; on Android however,\n \/\/ the values we get do not equal to the value we set.\n \/\/\n \/\/ Also, when we call zoomTo to set the zoom, on Android, it usually\n \/\/ honors the preferences that we set and the zoom cannot pass beyond the boundary.\n \/\/ On iOS, on the other hand, zoomTo seems to override the preferences.\n \/\/\n \/\/ Thus we test iOS and Android a little differently here.\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n GoogleMapController controller;\n\n const MinMaxZoomPreference initialZoomLevel = MinMaxZoomPreference(4, 8);\n const MinMaxZoomPreference finalZoomLevel = MinMaxZoomPreference(6, 10);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n minMaxZoomPreference: initialZoomLevel,\n onMapCreated: (GoogleMapController c) async {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(c.channel);\n controller = c;\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n\n if (Platform.isIOS) {\n MinMaxZoomPreference zoomLevel = await inspector.getMinMaxZoomLevels();\n expect(zoomLevel, equals(initialZoomLevel));\n } else if (Platform.isAndroid) {\n await controller.moveCamera(CameraUpdate.zoomTo(15));\n await tester.pumpAndSettle();\n double zoomLevel = await inspector.getZoomLevel();\n expect(zoomLevel, equals(initialZoomLevel.maxZoom));\n\n await controller.moveCamera(CameraUpdate.zoomTo(1));\n await tester.pumpAndSettle();\n zoomLevel = await inspector.getZoomLevel();\n expect(zoomLevel, equals(initialZoomLevel.minZoom));\n }\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n minMaxZoomPreference: finalZoomLevel,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n if (Platform.isIOS) {\n MinMaxZoomPreference zoomLevel = await inspector.getMinMaxZoomLevels();\n expect(zoomLevel, equals(finalZoomLevel));\n } else {\n await controller.moveCamera(CameraUpdate.zoomTo(15));\n await tester.pumpAndSettle();\n double zoomLevel = await inspector.getZoomLevel();\n expect(zoomLevel, equals(finalZoomLevel.maxZoom));\n\n await controller.moveCamera(CameraUpdate.zoomTo(1));\n await tester.pumpAndSettle();\n zoomLevel = await inspector.getZoomLevel();\n expect(zoomLevel, equals(finalZoomLevel.minZoom));\n }\n });\n\n testWidgets('testZoomGesturesEnabled', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n zoomGesturesEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool zoomGesturesEnabled = await inspector.isZoomGesturesEnabled();\n expect(zoomGesturesEnabled, false);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n zoomGesturesEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n zoomGesturesEnabled = await inspector.isZoomGesturesEnabled();\n expect(zoomGesturesEnabled, true);\n });\n\n testWidgets('testZoomControlsEnabled', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool zoomControlsEnabled = await inspector.isZoomControlsEnabled();\n expect(zoomControlsEnabled, Platform.isIOS ? false : true);\n\n \/\/\/ Zoom Controls functionality is not available on iOS at the moment.\n if (Platform.isAndroid) {\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n zoomControlsEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n zoomControlsEnabled = await inspector.isZoomControlsEnabled();\n expect(zoomControlsEnabled, false);\n }\n });\n\n testWidgets('testLiteModeEnabled', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n liteModeEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool liteModeEnabled = await inspector.isLiteModeEnabled();\n expect(liteModeEnabled, false);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n liteModeEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n liteModeEnabled = await inspector.isLiteModeEnabled();\n expect(liteModeEnabled, true);\n }, skip: !Platform.isAndroid);\n\n testWidgets('testRotateGesturesEnabled', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n rotateGesturesEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool rotateGesturesEnabled = await inspector.isRotateGesturesEnabled();\n expect(rotateGesturesEnabled, false);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n rotateGesturesEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n rotateGesturesEnabled = await inspector.isRotateGesturesEnabled();\n expect(rotateGesturesEnabled, true);\n });\n\n testWidgets('testTiltGesturesEnabled', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n tiltGesturesEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool tiltGesturesEnabled = await inspector.isTiltGesturesEnabled();\n expect(tiltGesturesEnabled, false);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n tiltGesturesEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n tiltGesturesEnabled = await inspector.isTiltGesturesEnabled();\n expect(tiltGesturesEnabled, true);\n });\n\n testWidgets('testScrollGesturesEnabled', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n scrollGesturesEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool scrollGesturesEnabled = await inspector.isScrollGesturesEnabled();\n expect(scrollGesturesEnabled, false);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n scrollGesturesEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n scrollGesturesEnabled = await inspector.isScrollGesturesEnabled();\n expect(scrollGesturesEnabled, true);\n });\n\n testWidgets('testInitialCenterLocationAtCenter', (WidgetTester tester) async {\n await tester.binding.setSurfaceSize(const Size(800.0, 600.0));\n final Completer mapControllerCompleter =\n Completer();\n final Key key = GlobalKey();\n await tester.pumpWidget(\n Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n mapControllerCompleter.complete(controller);\n },\n ),\n ),\n );\n final GoogleMapController mapController =\n await mapControllerCompleter.future;\n\n await tester.pumpAndSettle();\n\n \/\/ TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen\n \/\/ in `mapRendered`.\n \/\/ https:\/\/github.com\/flutter\/flutter\/issues\/54758\n await Future.delayed(Duration(seconds: 1));\n\n ScreenCoordinate coordinate =\n await mapController.getScreenCoordinate(_kInitialCameraPosition.target);\n Rect rect = tester.getRect(find.byKey(key));\n if (Platform.isIOS) {\n \/\/ On iOS, the coordinate value from the GoogleMapSdk doesn't include the devicePixelRatio`.\n \/\/ So we don't need to do the conversion like we did below for other platforms.\n expect(coordinate.x, (rect.center.dx - rect.topLeft.dx).round());\n expect(coordinate.y, (rect.center.dy - rect.topLeft.dy).round());\n } else {\n expect(\n coordinate.x,\n ((rect.center.dx - rect.topLeft.dx) *\n tester.binding.window.devicePixelRatio)\n .round());\n expect(\n coordinate.y,\n ((rect.center.dy - rect.topLeft.dy) *\n tester.binding.window.devicePixelRatio)\n .round());\n }\n await tester.binding.setSurfaceSize(null);\n });\n\n testWidgets('testGetVisibleRegion', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final LatLngBounds zeroLatLngBounds = LatLngBounds(\n southwest: const LatLng(0, 0), northeast: const LatLng(0, 0));\n\n final Completer mapControllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n mapControllerCompleter.complete(controller);\n },\n ),\n ));\n await tester.pumpAndSettle();\n\n final GoogleMapController mapController =\n await mapControllerCompleter.future;\n\n final LatLngBounds firstVisibleRegion =\n await mapController.getVisibleRegion();\n\n expect(firstVisibleRegion, isNotNull);\n expect(firstVisibleRegion.southwest, isNotNull);\n expect(firstVisibleRegion.northeast, isNotNull);\n expect(firstVisibleRegion, isNot(zeroLatLngBounds));\n expect(firstVisibleRegion.contains(_kInitialMapCenter), isTrue);\n\n \/\/ Making a new `LatLngBounds` about (10, 10) distance south west to the `firstVisibleRegion`.\n \/\/ The size of the `LatLngBounds` is 10 by 10.\n final LatLng southWest = LatLng(firstVisibleRegion.southwest.latitude - 20,\n firstVisibleRegion.southwest.longitude - 20);\n final LatLng northEast = LatLng(firstVisibleRegion.southwest.latitude - 10,\n firstVisibleRegion.southwest.longitude - 10);\n final LatLng newCenter = LatLng(\n (northEast.latitude + southWest.latitude) \/ 2,\n (northEast.longitude + southWest.longitude) \/ 2,\n );\n\n expect(firstVisibleRegion.contains(northEast), isFalse);\n expect(firstVisibleRegion.contains(southWest), isFalse);\n\n final LatLngBounds latLngBounds =\n LatLngBounds(southwest: southWest, northeast: northEast);\n\n \/\/ TODO(iskakaushik): non-zero padding is needed for some device configurations\n \/\/ https:\/\/github.com\/flutter\/flutter\/issues\/30575\n final double padding = 0;\n await mapController\n .moveCamera(CameraUpdate.newLatLngBounds(latLngBounds, padding));\n await tester.pumpAndSettle(const Duration(seconds: 3));\n\n final LatLngBounds secondVisibleRegion =\n await mapController.getVisibleRegion();\n\n expect(secondVisibleRegion, isNotNull);\n expect(secondVisibleRegion.southwest, isNotNull);\n expect(secondVisibleRegion.northeast, isNotNull);\n expect(secondVisibleRegion, isNot(zeroLatLngBounds));\n\n expect(firstVisibleRegion, isNot(secondVisibleRegion));\n expect(secondVisibleRegion.contains(newCenter), isTrue);\n });\n\n testWidgets('testTraffic', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n trafficEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool isTrafficEnabled = await inspector.isTrafficEnabled();\n expect(isTrafficEnabled, true);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n trafficEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n isTrafficEnabled = await inspector.isTrafficEnabled();\n expect(isTrafficEnabled, false);\n });\n\n testWidgets('testBuildings', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n buildingsEnabled: true,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n final bool isBuildingsEnabled = await inspector.isBuildingsEnabled();\n expect(isBuildingsEnabled, true);\n });\n\n \/\/ Location button tests are skipped in Android because we don't have location permission to test.\n testWidgets('testMyLocationButtonToggle', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n myLocationButtonEnabled: true,\n myLocationEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n bool myLocationButtonEnabled = await inspector.isMyLocationButtonEnabled();\n expect(myLocationButtonEnabled, true);\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n myLocationButtonEnabled: false,\n myLocationEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n fail(\"OnMapCreated should get called only once.\");\n },\n ),\n ));\n\n myLocationButtonEnabled = await inspector.isMyLocationButtonEnabled();\n expect(myLocationButtonEnabled, false);\n }, skip: Platform.isAndroid);\n\n testWidgets('testMyLocationButton initial value false',\n (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n myLocationButtonEnabled: false,\n myLocationEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n final bool myLocationButtonEnabled =\n await inspector.isMyLocationButtonEnabled();\n expect(myLocationButtonEnabled, false);\n }, skip: Platform.isAndroid);\n\n testWidgets('testMyLocationButton initial value true',\n (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n myLocationButtonEnabled: true,\n myLocationEnabled: false,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n final bool myLocationButtonEnabled =\n await inspector.isMyLocationButtonEnabled();\n expect(myLocationButtonEnabled, true);\n }, skip: Platform.isAndroid);\n\n testWidgets('testSetMapStyle valid Json String', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer controllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n controllerCompleter.complete(controller);\n },\n ),\n ));\n\n final GoogleMapController controller = await controllerCompleter.future;\n final String mapStyle =\n '[{\"elementType\":\"geometry\",\"stylers\":[{\"color\":\"#242f3e\"}]}]';\n await controller.setMapStyle(mapStyle);\n });\n\n testWidgets('testSetMapStyle invalid Json String',\n (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer controllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n controllerCompleter.complete(controller);\n },\n ),\n ));\n\n final GoogleMapController controller = await controllerCompleter.future;\n\n try {\n await controller.setMapStyle('invalid_value');\n fail('expected MapStyleException');\n } on MapStyleException catch (e) {\n expect(e.cause, isNotNull);\n }\n });\n\n testWidgets('testSetMapStyle null string', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer controllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n controllerCompleter.complete(controller);\n },\n ),\n ));\n\n final GoogleMapController controller = await controllerCompleter.future;\n await controller.setMapStyle(null);\n });\n\n testWidgets('testGetLatLng', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer controllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n controllerCompleter.complete(controller);\n },\n ),\n ));\n\n final GoogleMapController controller = await controllerCompleter.future;\n\n await tester.pumpAndSettle();\n \/\/ TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen\n \/\/ in `mapRendered`.\n \/\/ https:\/\/github.com\/flutter\/flutter\/issues\/54758\n await Future.delayed(Duration(seconds: 1));\n\n final LatLngBounds visibleRegion = await controller.getVisibleRegion();\n final LatLng topLeft =\n await controller.getLatLng(const ScreenCoordinate(x: 0, y: 0));\n final LatLng northWest = LatLng(\n visibleRegion.northeast.latitude,\n visibleRegion.southwest.longitude,\n );\n\n expect(topLeft, northWest);\n });\n\n testWidgets('testGetZoomLevel', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer controllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n controllerCompleter.complete(controller);\n },\n ),\n ));\n\n final GoogleMapController controller = await controllerCompleter.future;\n\n await tester.pumpAndSettle();\n \/\/ TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen\n \/\/ in `mapRendered`.\n \/\/ https:\/\/github.com\/flutter\/flutter\/issues\/54758\n await Future.delayed(Duration(seconds: 1));\n\n double zoom = await controller.getZoomLevel();\n expect(zoom, _kInitialZoomLevel);\n\n await controller.moveCamera(CameraUpdate.zoomTo(7));\n await tester.pumpAndSettle();\n zoom = await controller.getZoomLevel();\n expect(zoom, equals(7));\n });\n\n testWidgets('testScreenCoordinate', (WidgetTester tester) async {\n final Key key = GlobalKey();\n final Completer controllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n controllerCompleter.complete(controller);\n },\n ),\n ));\n final GoogleMapController controller = await controllerCompleter.future;\n\n await tester.pumpAndSettle();\n \/\/ TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen\n \/\/ in `mapRendered`.\n \/\/ https:\/\/github.com\/flutter\/flutter\/issues\/54758\n await Future.delayed(Duration(seconds: 1));\n\n final LatLngBounds visibleRegion = await controller.getVisibleRegion();\n final LatLng northWest = LatLng(\n visibleRegion.northeast.latitude,\n visibleRegion.southwest.longitude,\n );\n final ScreenCoordinate topLeft =\n await controller.getScreenCoordinate(northWest);\n expect(topLeft, const ScreenCoordinate(x: 0, y: 0));\n });\n\n testWidgets('testResizeWidget', (WidgetTester tester) async {\n final Completer controllerCompleter =\n Completer();\n final GoogleMap map = GoogleMap(\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) async {\n controllerCompleter.complete(controller);\n },\n );\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: MaterialApp(\n home: Scaffold(\n body: SizedBox(height: 100, width: 100, child: map)))));\n final GoogleMapController controller = await controllerCompleter.future;\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: MaterialApp(\n home: Scaffold(\n body: SizedBox(height: 400, width: 400, child: map)))));\n\n await tester.pumpAndSettle();\n \/\/ TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen\n \/\/ in `mapRendered`.\n \/\/ https:\/\/github.com\/flutter\/flutter\/issues\/54758\n await Future.delayed(Duration(seconds: 1));\n\n \/\/ Simple call to make sure that the app hasn't crashed.\n final LatLngBounds bounds1 = await controller.getVisibleRegion();\n final LatLngBounds bounds2 = await controller.getVisibleRegion();\n expect(bounds1, bounds2);\n });\n\n testWidgets('testToggleInfoWindow', (WidgetTester tester) async {\n final Marker marker = Marker(\n markerId: MarkerId(\"marker\"),\n infoWindow: InfoWindow(title: \"InfoWindow\"));\n final Set markers = {marker};\n\n Completer controllerCompleter =\n Completer();\n\n await tester.pumpWidget(Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n initialCameraPosition: const CameraPosition(target: LatLng(10.0, 15.0)),\n markers: markers,\n onMapCreated: (GoogleMapController googleMapController) {\n controllerCompleter.complete(googleMapController);\n },\n ),\n ));\n\n GoogleMapController controller = await controllerCompleter.future;\n\n bool iwVisibleStatus =\n await controller.isMarkerInfoWindowShown(marker.markerId);\n expect(iwVisibleStatus, false);\n\n await controller.showMarkerInfoWindow(marker.markerId);\n iwVisibleStatus = await controller.isMarkerInfoWindowShown(marker.markerId);\n expect(iwVisibleStatus, true);\n\n await controller.hideMarkerInfoWindow(marker.markerId);\n iwVisibleStatus = await controller.isMarkerInfoWindowShown(marker.markerId);\n expect(iwVisibleStatus, false);\n });\n\n testWidgets(\"fromAssetImage\", (WidgetTester tester) async {\n double pixelRatio = 2;\n final ImageConfiguration imageConfiguration =\n ImageConfiguration(devicePixelRatio: pixelRatio);\n final BitmapDescriptor mip = await BitmapDescriptor.fromAssetImage(\n imageConfiguration, 'red_square.png');\n final BitmapDescriptor scaled = await BitmapDescriptor.fromAssetImage(\n imageConfiguration, 'red_square.png',\n mipmaps: false);\n expect((mip.toJson() as List)[2], 1);\n expect((scaled.toJson() as List)[2], 2);\n });\n\n testWidgets('testTakeSnapshot', (WidgetTester tester) async {\n Completer inspectorCompleter =\n Completer();\n\n await tester.pumpWidget(\n Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ),\n );\n\n await tester.pumpAndSettle(const Duration(seconds: 3));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n final Uint8List bytes = await inspector.takeSnapshot();\n expect(bytes?.isNotEmpty, true);\n },\n \/\/ TODO(cyanglaz): un-skip the test when we can test this on CI with API key enabled.\n \/\/ https:\/\/github.com\/flutter\/flutter\/issues\/57057\n skip: Platform.isAndroid);\n\n testWidgets(\n 'set tileOverlay correctly',\n (WidgetTester tester) async {\n Completer inspectorCompleter =\n Completer();\n final TileOverlay tileOverlay1 = TileOverlay(\n tileOverlayId: TileOverlayId('tile_overlay_1'),\n tileProvider: _DebugTileProvider(),\n zIndex: 2,\n visible: true,\n transparency: 0.2,\n fadeIn: true,\n );\n\n final TileOverlay tileOverlay2 = TileOverlay(\n tileOverlayId: TileOverlayId('tile_overlay_2'),\n tileProvider: _DebugTileProvider(),\n zIndex: 1,\n visible: false,\n transparency: 0.3,\n fadeIn: false,\n );\n await tester.pumpWidget(\n Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n initialCameraPosition: _kInitialCameraPosition,\n tileOverlays: {tileOverlay1, tileOverlay2},\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ),\n );\n await tester.pumpAndSettle(const Duration(seconds: 3));\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n\n Map tileOverlayInfo1 =\n await inspector.getTileOverlayInfo('tile_overlay_1');\n Map tileOverlayInfo2 =\n await inspector.getTileOverlayInfo('tile_overlay_2');\n\n expect(tileOverlayInfo1['visible'], isTrue);\n expect(tileOverlayInfo1['fadeIn'], isTrue);\n expect(tileOverlayInfo1['transparency'],\n moreOrLessEquals(0.2, epsilon: 0.001));\n expect(tileOverlayInfo1['zIndex'], 2);\n\n expect(tileOverlayInfo2['visible'], isFalse);\n expect(tileOverlayInfo2['fadeIn'], isFalse);\n expect(tileOverlayInfo2['transparency'],\n moreOrLessEquals(0.3, epsilon: 0.001));\n expect(tileOverlayInfo2['zIndex'], 1);\n },\n );\n\n testWidgets(\n 'update tileOverlays correctly',\n (WidgetTester tester) async {\n Completer inspectorCompleter =\n Completer();\n final Key key = GlobalKey();\n final TileOverlay tileOverlay1 = TileOverlay(\n tileOverlayId: TileOverlayId('tile_overlay_1'),\n tileProvider: _DebugTileProvider(),\n zIndex: 2,\n visible: true,\n transparency: 0.2,\n fadeIn: true,\n );\n\n final TileOverlay tileOverlay2 = TileOverlay(\n tileOverlayId: TileOverlayId('tile_overlay_2'),\n tileProvider: _DebugTileProvider(),\n zIndex: 3,\n visible: true,\n transparency: 0.5,\n fadeIn: true,\n );\n await tester.pumpWidget(\n Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n tileOverlays: {tileOverlay1, tileOverlay2},\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ),\n );\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n\n final TileOverlay tileOverlay1New = TileOverlay(\n tileOverlayId: TileOverlayId('tile_overlay_1'),\n tileProvider: _DebugTileProvider(),\n zIndex: 1,\n visible: false,\n transparency: 0.3,\n fadeIn: false,\n );\n\n await tester.pumpWidget(\n Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n tileOverlays: {tileOverlay1New},\n onMapCreated: (GoogleMapController controller) {\n fail('update: OnMapCreated should get called only once.');\n },\n ),\n ),\n );\n\n await tester.pumpAndSettle(const Duration(seconds: 3));\n\n Map tileOverlayInfo1 =\n await inspector.getTileOverlayInfo('tile_overlay_1');\n Map tileOverlayInfo2 =\n await inspector.getTileOverlayInfo('tile_overlay_2');\n\n expect(tileOverlayInfo1['visible'], isFalse);\n expect(tileOverlayInfo1['fadeIn'], isFalse);\n expect(tileOverlayInfo1['transparency'],\n moreOrLessEquals(0.3, epsilon: 0.001));\n expect(tileOverlayInfo1['zIndex'], 1);\n\n expect(tileOverlayInfo2, isNull);\n },\n );\n\n testWidgets(\n 'remove tileOverlays correctly',\n (WidgetTester tester) async {\n Completer inspectorCompleter =\n Completer();\n final Key key = GlobalKey();\n final TileOverlay tileOverlay1 = TileOverlay(\n tileOverlayId: TileOverlayId('tile_overlay_1'),\n tileProvider: _DebugTileProvider(),\n zIndex: 2,\n visible: true,\n transparency: 0.2,\n fadeIn: true,\n );\n\n await tester.pumpWidget(\n Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n tileOverlays: {tileOverlay1},\n onMapCreated: (GoogleMapController controller) {\n final GoogleMapInspector inspector =\n \/\/ ignore: invalid_use_of_visible_for_testing_member\n GoogleMapInspector(controller.channel);\n inspectorCompleter.complete(inspector);\n },\n ),\n ),\n );\n\n final GoogleMapInspector inspector = await inspectorCompleter.future;\n\n await tester.pumpWidget(\n Directionality(\n textDirection: TextDirection.ltr,\n child: GoogleMap(\n key: key,\n initialCameraPosition: _kInitialCameraPosition,\n onMapCreated: (GoogleMapController controller) {\n fail('OnMapCreated should get called only once.');\n },\n ),\n ),\n );\n\n await tester.pumpAndSettle(const Duration(seconds: 3));\n Map tileOverlayInfo1 =\n await inspector.getTileOverlayInfo('tile_overlay_1');\n\n expect(tileOverlayInfo1, isNull);\n },\n );\n}\n\nclass _DebugTileProvider implements TileProvider {\n _DebugTileProvider() {\n boxPaint.isAntiAlias = true;\n boxPaint.color = Colors.blue;\n boxPaint.strokeWidth = 2.0;\n boxPaint.style = PaintingStyle.stroke;\n }\n\n static const int width = 100;\n static const int height = 100;\n static final Paint boxPaint = Paint();\n static final TextStyle textStyle = TextStyle(\n color: Colors.red,\n fontSize: 20,\n );\n\n @override\n Future getTile(int x, int y, int zoom) async {\n final ui.PictureRecorder recorder = ui.PictureRecorder();\n final Canvas canvas = Canvas(recorder);\n final TextSpan textSpan = TextSpan(\n text: \"$x,$y\",\n style: textStyle,\n );\n final TextPainter textPainter = TextPainter(\n text: textSpan,\n textDirection: TextDirection.ltr,\n );\n textPainter.layout(\n minWidth: 0.0,\n maxWidth: width.toDouble(),\n );\n final Offset offset = const Offset(0, 0);\n textPainter.paint(canvas, offset);\n canvas.drawRect(\n Rect.fromLTRB(0, 0, width.toDouble(), width.toDouble()), boxPaint);\n final ui.Picture picture = recorder.endRecording();\n final Uint8List byteData = await picture\n .toImage(width, height)\n .then((ui.Image image) =>\n image.toByteData(format: ui.ImageByteFormat.png))\n .then((ByteData byteData) => byteData.buffer.asUint8List());\n return Tile(width, height, byteData);\n }\n}\n","avg_line_length":35.9124797407,"max_line_length":143,"alphanum_fraction":0.6840193158} {"size":54955,"ext":"dart","lang":"Dart","max_stars_count":5.0,"content":"\/\/ Copyright 2014 The Flutter Authors. All rights reserved.\n\/\/ Use of this source code is governed by a BSD-style license that can be\n\/\/ found in the LICENSE file.\n\n\/\/ @dart = 2.8\n\nimport 'dart:math' as math;\nimport 'dart:ui';\n\nimport 'package:flutter\/foundation.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter\/rendering.dart';\nimport 'package:flutter\/services.dart';\nimport 'package:flutter_test\/flutter_test.dart';\n\nimport '..\/rendering\/mock_canvas.dart';\nimport '..\/widgets\/semantics_tester.dart';\n\nclass TestIcon extends StatefulWidget {\n const TestIcon({ Key key }) : super(key: key);\n\n @override\n TestIconState createState() => TestIconState();\n}\n\nclass TestIconState extends State {\n IconThemeData iconTheme;\n\n @override\n Widget build(BuildContext context) {\n iconTheme = IconTheme.of(context);\n return const Icon(Icons.add);\n }\n}\n\nclass TestText extends StatefulWidget {\n const TestText(this.text, { Key key }) : super(key: key);\n\n final String text;\n\n @override\n TestTextState createState() => TestTextState();\n}\n\nclass TestTextState extends State {\n TextStyle textStyle;\n\n @override\n Widget build(BuildContext context) {\n textStyle = DefaultTextStyle.of(context).style;\n return Text(widget.text);\n }\n}\n\nvoid main() {\n testWidgets('ListTile geometry (LTR)', (WidgetTester tester) async {\n \/\/ See https:\/\/material.io\/go\/design-lists\n\n final Key leadingKey = GlobalKey();\n final Key trailingKey = GlobalKey();\n bool hasSubtitle;\n\n const double leftPadding = 10.0;\n const double rightPadding = 20.0;\n Widget buildFrame({ bool dense = false, bool isTwoLine = false, bool isThreeLine = false, double textScaleFactor = 1.0, double subtitleScaleFactor }) {\n hasSubtitle = isTwoLine || isThreeLine;\n subtitleScaleFactor ??= textScaleFactor;\n return MaterialApp(\n home: MediaQuery(\n data: MediaQueryData(\n padding: const EdgeInsets.only(left: leftPadding, right: rightPadding),\n textScaleFactor: textScaleFactor,\n ),\n child: Material(\n child: Center(\n child: ListTile(\n leading: Container(key: leadingKey, width: 24.0, height: 24.0),\n title: const Text('title'),\n subtitle: hasSubtitle ? Text('subtitle', textScaleFactor: subtitleScaleFactor) : null,\n trailing: Container(key: trailingKey, width: 24.0, height: 24.0),\n dense: dense,\n isThreeLine: isThreeLine,\n ),\n ),\n ),\n ),\n );\n }\n\n void testChildren() {\n expect(find.byKey(leadingKey), findsOneWidget);\n expect(find.text('title'), findsOneWidget);\n if (hasSubtitle)\n expect(find.text('subtitle'), findsOneWidget);\n expect(find.byKey(trailingKey), findsOneWidget);\n }\n\n double left(String text) => tester.getTopLeft(find.text(text)).dx;\n double top(String text) => tester.getTopLeft(find.text(text)).dy;\n double bottom(String text) => tester.getBottomLeft(find.text(text)).dy;\n double height(String text) => tester.getRect(find.text(text)).height;\n\n double leftKey(Key key) => tester.getTopLeft(find.byKey(key)).dx;\n double rightKey(Key key) => tester.getTopRight(find.byKey(key)).dx;\n double widthKey(Key key) => tester.getSize(find.byKey(key)).width;\n double heightKey(Key key) => tester.getSize(find.byKey(key)).height;\n\n \/\/ ListTiles are contained by a SafeArea defined like this:\n \/\/ SafeArea(top: false, bottom: false, minimum: contentPadding)\n \/\/ The default contentPadding is 16.0 on the left and right.\n void testHorizontalGeometry() {\n expect(leftKey(leadingKey), math.max(16.0, leftPadding));\n expect(left('title'), 56.0 + math.max(16.0, leftPadding));\n if (hasSubtitle)\n expect(left('subtitle'), 56.0 + math.max(16.0, leftPadding));\n expect(left('title'), rightKey(leadingKey) + 32.0);\n expect(rightKey(trailingKey), 800.0 - math.max(16.0, rightPadding));\n expect(widthKey(trailingKey), 24.0);\n }\n\n void testVerticalGeometry(double expectedHeight) {\n final Rect tileRect = tester.getRect(find.byType(ListTile));\n expect(tileRect.size, Size(800.0, expectedHeight));\n expect(top('title'), greaterThanOrEqualTo(tileRect.top));\n if (hasSubtitle) {\n expect(top('subtitle'), greaterThanOrEqualTo(bottom('title')));\n expect(bottom('subtitle'), lessThan(tileRect.bottom));\n } else {\n expect(top('title'), equals(tileRect.top + (tileRect.height - height('title')) \/ 2.0));\n }\n expect(heightKey(trailingKey), 24.0);\n }\n\n await tester.pumpWidget(buildFrame());\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(56.0);\n\n await tester.pumpWidget(buildFrame(dense: true));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(48.0);\n\n await tester.pumpWidget(buildFrame(isTwoLine: true));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(72.0);\n\n await tester.pumpWidget(buildFrame(isTwoLine: true, dense: true));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(64.0);\n\n await tester.pumpWidget(buildFrame(isThreeLine: true));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(88.0);\n\n await tester.pumpWidget(buildFrame(isThreeLine: true, dense: true));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(76.0);\n\n await tester.pumpWidget(buildFrame(textScaleFactor: 4.0));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(72.0);\n\n await tester.pumpWidget(buildFrame(dense: true, textScaleFactor: 4.0));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(72.0);\n\n await tester.pumpWidget(buildFrame(isTwoLine: true, textScaleFactor: 4.0));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(128.0);\n\n \/\/ Make sure that the height of a large subtitle is taken into account.\n await tester.pumpWidget(buildFrame(isTwoLine: true, textScaleFactor: 0.5, subtitleScaleFactor: 4.0));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(72.0);\n\n await tester.pumpWidget(buildFrame(isTwoLine: true, dense: true, textScaleFactor: 4.0));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(128.0);\n\n await tester.pumpWidget(buildFrame(isThreeLine: true, textScaleFactor: 4.0));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(128.0);\n\n await tester.pumpWidget(buildFrame(isThreeLine: true, dense: true, textScaleFactor: 4.0));\n testChildren();\n testHorizontalGeometry();\n testVerticalGeometry(128.0);\n });\n\n testWidgets('ListTile geometry (RTL)', (WidgetTester tester) async {\n const double leftPadding = 10.0;\n const double rightPadding = 20.0;\n await tester.pumpWidget(const MediaQuery(\n data: MediaQueryData(\n padding: EdgeInsets.only(left: leftPadding, right: rightPadding),\n ),\n child: Directionality(\n textDirection: TextDirection.rtl,\n child: Material(\n child: Center(\n child: ListTile(\n leading: Text('L'),\n title: Text('title'),\n trailing: Text('T'),\n ),\n ),\n ),\n ),\n ));\n\n double left(String text) => tester.getTopLeft(find.text(text)).dx;\n double right(String text) => tester.getTopRight(find.text(text)).dx;\n\n void testHorizontalGeometry() {\n expect(right('L'), 800.0 - math.max(16.0, rightPadding));\n expect(right('title'), 800.0 - 56.0 - math.max(16.0, rightPadding));\n expect(left('T'), math.max(16.0, leftPadding));\n }\n\n testHorizontalGeometry();\n });\n\n testWidgets('ListTile.divideTiles', (WidgetTester tester) async {\n final List titles = [ 'first', 'second', 'third' ];\n\n await tester.pumpWidget(MaterialApp(\n home: Material(\n child: Builder(\n builder: (BuildContext context) {\n return ListView(\n children: ListTile.divideTiles(\n context: context,\n tiles: titles.map((String title) => ListTile(title: Text(title))),\n ).toList(),\n );\n },\n ),\n ),\n ));\n\n expect(find.text('first'), findsOneWidget);\n expect(find.text('second'), findsOneWidget);\n expect(find.text('third'), findsOneWidget);\n });\n\n testWidgets('ListTileTheme', (WidgetTester tester) async {\n final Key titleKey = UniqueKey();\n final Key subtitleKey = UniqueKey();\n final Key leadingKey = UniqueKey();\n final Key trailingKey = UniqueKey();\n ThemeData theme;\n\n Widget buildFrame({\n bool enabled = true,\n bool dense = false,\n bool selected = false,\n ShapeBorder shape,\n Color selectedColor,\n Color iconColor,\n Color textColor,\n }) {\n return MaterialApp(\n home: Material(\n child: Center(\n child: ListTileTheme(\n dense: dense,\n shape: shape,\n selectedColor: selectedColor,\n iconColor: iconColor,\n textColor: textColor,\n child: Builder(\n builder: (BuildContext context) {\n theme = Theme.of(context);\n return ListTile(\n enabled: enabled,\n selected: selected,\n leading: TestIcon(key: leadingKey),\n trailing: TestIcon(key: trailingKey),\n title: TestText('title', key: titleKey),\n subtitle: TestText('subtitle', key: subtitleKey),\n );\n }\n ),\n ),\n ),\n ),\n );\n }\n\n const Color green = Color(0xFF00FF00);\n const Color red = Color(0xFFFF0000);\n const ShapeBorder roundedShape = RoundedRectangleBorder(\n borderRadius: BorderRadius.all(Radius.circular(4.0)),\n );\n\n Color iconColor(Key key) => tester.state(find.byKey(key)).iconTheme.color;\n Color textColor(Key key) => tester.state(find.byKey(key)).textStyle.color;\n ShapeBorder inkWellBorder() => tester.widget(find.descendant(of: find.byType(ListTile), matching: find.byType(InkWell))).customBorder;\n\n \/\/ A selected ListTile's leading, trailing, and text get the primary color by default\n await tester.pumpWidget(buildFrame(selected: true));\n await tester.pump(const Duration(milliseconds: 300)); \/\/ DefaultTextStyle changes animate\n expect(iconColor(leadingKey), theme.primaryColor);\n expect(iconColor(trailingKey), theme.primaryColor);\n expect(textColor(titleKey), theme.primaryColor);\n expect(textColor(subtitleKey), theme.primaryColor);\n\n \/\/ A selected ListTile's leading, trailing, and text get the ListTileTheme's selectedColor\n await tester.pumpWidget(buildFrame(selected: true, selectedColor: green));\n await tester.pump(const Duration(milliseconds: 300)); \/\/ DefaultTextStyle changes animate\n expect(iconColor(leadingKey), green);\n expect(iconColor(trailingKey), green);\n expect(textColor(titleKey), green);\n expect(textColor(subtitleKey), green);\n\n \/\/ An unselected ListTile's leading and trailing get the ListTileTheme's iconColor\n \/\/ An unselected ListTile's title texts get the ListTileTheme's textColor\n await tester.pumpWidget(buildFrame(iconColor: red, textColor: green));\n await tester.pump(const Duration(milliseconds: 300)); \/\/ DefaultTextStyle changes animate\n expect(iconColor(leadingKey), red);\n expect(iconColor(trailingKey), red);\n expect(textColor(titleKey), green);\n expect(textColor(subtitleKey), green);\n\n \/\/ If the item is disabled it's rendered with the theme's disabled color.\n await tester.pumpWidget(buildFrame(enabled: false));\n await tester.pump(const Duration(milliseconds: 300)); \/\/ DefaultTextStyle changes animate\n expect(iconColor(leadingKey), theme.disabledColor);\n expect(iconColor(trailingKey), theme.disabledColor);\n expect(textColor(titleKey), theme.disabledColor);\n expect(textColor(subtitleKey), theme.disabledColor);\n\n \/\/ If the item is disabled it's rendered with the theme's disabled color.\n \/\/ Even if it's selected.\n await tester.pumpWidget(buildFrame(enabled: false, selected: true));\n await tester.pump(const Duration(milliseconds: 300)); \/\/ DefaultTextStyle changes animate\n expect(iconColor(leadingKey), theme.disabledColor);\n expect(iconColor(trailingKey), theme.disabledColor);\n expect(textColor(titleKey), theme.disabledColor);\n expect(textColor(subtitleKey), theme.disabledColor);\n\n \/\/ A selected ListTile's InkWell gets the ListTileTheme's shape\n await tester.pumpWidget(buildFrame(selected: true, shape: roundedShape));\n expect(inkWellBorder(), roundedShape);\n });\n\n testWidgets('ListTile semantics', (WidgetTester tester) async {\n final SemanticsTester semantics = SemanticsTester(tester);\n\n await tester.pumpWidget(\n Material(\n child: Directionality(\n textDirection: TextDirection.ltr,\n child: MediaQuery(\n data: const MediaQueryData(),\n child: Column(\n children: [\n const ListTile(\n title: Text('one'),\n ),\n ListTile(\n title: const Text('two'),\n onTap: () {},\n ),\n const ListTile(\n title: Text('three'),\n selected: true,\n ),\n const ListTile(\n title: Text('four'),\n enabled: false,\n ),\n ],\n ),\n ),\n ),\n ),\n );\n\n expect(\n semantics,\n hasSemantics(\n TestSemantics.root(\n children: [\n TestSemantics.rootChild(\n flags: [\n SemanticsFlag.hasEnabledState,\n SemanticsFlag.isEnabled,\n ],\n label: 'one',\n ),\n TestSemantics.rootChild(\n flags: [\n SemanticsFlag.hasEnabledState,\n SemanticsFlag.isEnabled,\n SemanticsFlag.isFocusable,\n ],\n actions: [SemanticsAction.tap],\n label: 'two',\n ),\n TestSemantics.rootChild(\n flags: [\n SemanticsFlag.isSelected,\n SemanticsFlag.hasEnabledState,\n SemanticsFlag.isEnabled,\n ],\n label: 'three',\n ),\n TestSemantics.rootChild(\n flags: [\n SemanticsFlag.hasEnabledState,\n ],\n label: 'four',\n ),\n ],\n ),\n ignoreTransform: true,\n ignoreId: true,\n ignoreRect: true,\n ),\n );\n\n semantics.dispose();\n });\n\n testWidgets('ListTile contentPadding', (WidgetTester tester) async {\n Widget buildFrame(TextDirection textDirection) {\n return MediaQuery(\n data: const MediaQueryData(\n padding: EdgeInsets.zero,\n textScaleFactor: 1.0,\n ),\n child: Directionality(\n textDirection: textDirection,\n child: Material(\n child: Container(\n alignment: Alignment.topLeft,\n child: const ListTile(\n contentPadding: EdgeInsetsDirectional.only(\n start: 10.0,\n end: 20.0,\n top: 30.0,\n bottom: 40.0,\n ),\n leading: Text('L'),\n title: Text('title'),\n trailing: Text('T'),\n ),\n ),\n ),\n ),\n );\n }\n\n double left(String text) => tester.getTopLeft(find.text(text)).dx;\n double right(String text) => tester.getTopRight(find.text(text)).dx;\n\n await tester.pumpWidget(buildFrame(TextDirection.ltr));\n\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 126.0)); \/\/ 126 = 56 + 30 + 40\n expect(left('L'), 10.0); \/\/ contentPadding.start = 10\n expect(right('T'), 780.0); \/\/ 800 - contentPadding.end\n\n await tester.pumpWidget(buildFrame(TextDirection.rtl));\n\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 126.0)); \/\/ 126 = 56 + 30 + 40\n expect(left('T'), 20.0); \/\/ contentPadding.end = 20\n expect(right('L'), 790.0); \/\/ 800 - contentPadding.start\n });\n\n testWidgets('ListTile contentPadding', (WidgetTester tester) async {\n Widget buildFrame(TextDirection textDirection) {\n return MediaQuery(\n data: const MediaQueryData(\n padding: EdgeInsets.zero,\n textScaleFactor: 1.0,\n ),\n child: Directionality(\n textDirection: textDirection,\n child: Material(\n child: Container(\n alignment: Alignment.topLeft,\n child: const ListTile(\n contentPadding: EdgeInsetsDirectional.only(\n start: 10.0,\n end: 20.0,\n top: 30.0,\n bottom: 40.0,\n ),\n leading: Text('L'),\n title: Text('title'),\n trailing: Text('T'),\n ),\n ),\n ),\n ),\n );\n }\n\n double left(String text) => tester.getTopLeft(find.text(text)).dx;\n double right(String text) => tester.getTopRight(find.text(text)).dx;\n\n await tester.pumpWidget(buildFrame(TextDirection.ltr));\n\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 126.0)); \/\/ 126 = 56 + 30 + 40\n expect(left('L'), 10.0); \/\/ contentPadding.start = 10\n expect(right('T'), 780.0); \/\/ 800 - contentPadding.end\n\n await tester.pumpWidget(buildFrame(TextDirection.rtl));\n\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 126.0)); \/\/ 126 = 56 + 30 + 40\n expect(left('T'), 20.0); \/\/ contentPadding.end = 20\n expect(right('L'), 790.0); \/\/ 800 - contentPadding.start\n });\n\n testWidgets('ListTileTheme wide leading Widget', (WidgetTester tester) async {\n const Key leadingKey = ValueKey('L');\n\n Widget buildFrame(double leadingWidth, TextDirection textDirection) {\n return MediaQuery(\n data: const MediaQueryData(\n padding: EdgeInsets.zero,\n textScaleFactor: 1.0,\n ),\n child: Directionality(\n textDirection: textDirection,\n child: Material(\n child: Container(\n alignment: Alignment.topLeft,\n child: ListTile(\n contentPadding: EdgeInsets.zero,\n leading: SizedBox(key: leadingKey, width: leadingWidth, height: 32.0),\n title: const Text('title'),\n subtitle: const Text('subtitle'),\n ),\n ),\n ),\n ),\n );\n }\n\n double left(String text) => tester.getTopLeft(find.text(text)).dx;\n double right(String text) => tester.getTopRight(find.text(text)).dx;\n\n \/\/ textDirection = LTR\n\n \/\/ Two-line tile's height = 72, leading 24x32 widget is positioned 16.0 pixels from the top.\n await tester.pumpWidget(buildFrame(24.0, TextDirection.ltr));\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 72.0));\n expect(tester.getTopLeft(find.byKey(leadingKey)), const Offset(0.0, 16.0));\n expect(tester.getBottomRight(find.byKey(leadingKey)), const Offset(24.0, 16.0 + 32.0));\n\n \/\/ Leading widget's width is 20, so default layout: the left edges of the\n \/\/ title and subtitle are at 56dps (contentPadding is zero).\n expect(left('title'), 56.0);\n expect(left('subtitle'), 56.0);\n\n \/\/ If the leading widget is wider than 40 it is separated from the\n \/\/ title and subtitle by 16.\n await tester.pumpWidget(buildFrame(56.0, TextDirection.ltr));\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 72.0));\n expect(tester.getTopLeft(find.byKey(leadingKey)), const Offset(0.0, 16.0));\n expect(tester.getBottomRight(find.byKey(leadingKey)), const Offset(56.0, 16.0 + 32.0));\n expect(left('title'), 72.0);\n expect(left('subtitle'), 72.0);\n\n \/\/ Same tests, textDirection = RTL\n\n await tester.pumpWidget(buildFrame(24.0, TextDirection.rtl));\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 72.0));\n expect(tester.getTopRight(find.byKey(leadingKey)), const Offset(800.0, 16.0));\n expect(tester.getBottomLeft(find.byKey(leadingKey)), const Offset(800.0 - 24.0, 16.0 + 32.0));\n expect(right('title'), 800.0 - 56.0);\n expect(right('subtitle'), 800.0 - 56.0);\n\n await tester.pumpWidget(buildFrame(56.0, TextDirection.rtl));\n expect(tester.getSize(find.byType(ListTile)), const Size(800.0, 72.0));\n expect(tester.getTopRight(find.byKey(leadingKey)), const Offset(800.0, 16.0));\n expect(tester.getBottomLeft(find.byKey(leadingKey)), const Offset(800.0 - 56.0, 16.0 + 32.0));\n expect(right('title'), 800.0 - 72.0);\n expect(right('subtitle'), 800.0 - 72.0);\n });\n\n testWidgets('ListTile leading and trailing positions', (WidgetTester tester) async {\n \/\/ This test is based on the redlines at\n \/\/ https:\/\/material.io\/design\/components\/lists.html#specs\n\n \/\/ DENSE \"ONE\"-LINE\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n dense: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A\\nB\\nC\\nD\\nE\\nF\\nG\\nH\\nI\\nJ\\nK\\nL\\nM'),\n ),\n ListTile(\n dense: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n ),\n ],\n ),\n ),\n ),\n );\n \/\/ LEFT TOP WIDTH HEIGHT\n expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 177.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));\n expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 177.0, 800.0, 48.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 177.0 + 4.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 177.0 + 12.0, 24.0, 24.0));\n\n \/\/ NON-DENSE \"ONE\"-LINE\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A\\nB\\nC\\nD\\nE\\nF\\nG\\nH\\nI\\nJ\\nK\\nL\\nM'),\n ),\n ListTile(\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n ),\n ],\n ),\n ),\n ),\n );\n await tester.pump(const Duration(seconds: 2)); \/\/ the text styles are animated when we change dense\n \/\/ LEFT TOP WIDTH HEIGHT\n expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 216.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));\n expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 216.0 , 800.0, 56.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 216.0 + 8.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 216.0 + 16.0, 24.0, 24.0));\n\n \/\/ DENSE \"TWO\"-LINE\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n dense: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A\\nB\\nC\\nD\\nE\\nF\\nG\\nH\\nI\\nJ\\nK\\nL\\nM'),\n ),\n ListTile(\n dense: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A'),\n ),\n ],\n ),\n ),\n ),\n );\n \/\/ LEFT TOP WIDTH HEIGHT\n expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));\n expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 64.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 12.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 20.0, 24.0, 24.0));\n\n \/\/ NON-DENSE \"TWO\"-LINE\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A\\nB\\nC\\nD\\nE\\nF\\nG\\nH\\nI\\nJ\\nK\\nL\\nM'),\n ),\n ListTile(\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A'),\n ),\n ],\n ),\n ),\n ),\n );\n \/\/ LEFT TOP WIDTH HEIGHT\n expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));\n expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 72.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 24.0, 24.0, 24.0));\n\n \/\/ DENSE \"THREE\"-LINE\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n dense: true,\n isThreeLine: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A\\nB\\nC\\nD\\nE\\nF\\nG\\nH\\nI\\nJ\\nK\\nL\\nM'),\n ),\n ListTile(\n dense: true,\n isThreeLine: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A'),\n ),\n ],\n ),\n ),\n ),\n );\n \/\/ LEFT TOP WIDTH HEIGHT\n expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));\n expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 76.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 16.0, 24.0, 24.0));\n\n \/\/ NON-DENSE THREE-LINE\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n isThreeLine: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A\\nB\\nC\\nD\\nE\\nF\\nG\\nH\\nI\\nJ\\nK\\nL\\nM'),\n ),\n ListTile(\n isThreeLine: true,\n leading: CircleAvatar(),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n subtitle: Text('A'),\n ),\n ],\n ),\n ),\n ),\n );\n \/\/ LEFT TOP WIDTH HEIGHT\n expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));\n expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 88.0));\n expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 16.0, 24.0, 24.0));\n\n \/\/ \"ONE-LINE\" with Small Leading Widget\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: SizedBox(height:12.0, width:24.0, child: Placeholder()),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A\\nB\\nC\\nD\\nE\\nF\\nG\\nH\\nI\\nJ\\nK\\nL\\nM'),\n ),\n ListTile(\n leading: SizedBox(height:12.0, width:24.0, child: Placeholder()),\n trailing: SizedBox(height: 24.0, width: 24.0, child: Placeholder()),\n title: Text('A'),\n ),\n ],\n ),\n ),\n ),\n );\n await tester.pump(const Duration(seconds: 2)); \/\/ the text styles are animated when we change dense\n \/\/ LEFT TOP WIDTH HEIGHT\n expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 216.0));\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH( 16.0, 16.0, 24.0, 12.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));\n expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 216.0 , 800.0, 56.0));\n expect(tester.getRect(find.byType(Placeholder).at(2)), const Rect.fromLTWH( 16.0, 216.0 + 16.0, 24.0, 12.0));\n expect(tester.getRect(find.byType(Placeholder).at(3)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 216.0 + 16.0, 24.0, 24.0));\n });\n\n testWidgets('ListTile leading icon height does not exceed ListTile height', (WidgetTester tester) async {\n \/\/ regression test for https:\/\/github.com\/flutter\/flutter\/issues\/28765\n const SizedBox oversizedWidget = SizedBox(height: 80.0, width: 24.0, child: Placeholder());\n\n \/\/ Dense One line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: oversizedWidget,\n title: Text('A'),\n dense: true,\n ),\n ListTile(\n leading: oversizedWidget,\n title: Text('B'),\n dense: true,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 0.0, 24.0, 48.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 48.0, 24.0, 48.0));\n\n \/\/ Non-dense One line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: oversizedWidget,\n title: Text('A'),\n dense: false,\n ),\n ListTile(\n leading: oversizedWidget,\n title: Text('B'),\n dense: false,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 0.0, 24.0, 56.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 56.0, 24.0, 56.0));\n\n \/\/ Dense Two line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n dense: true,\n ),\n ListTile(\n leading: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n dense: true,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 8.0, 24.0, 48.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 64.0 + 8.0, 24.0, 48.0));\n\n \/\/ Non-dense Two line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n dense: false,\n ),\n ListTile(\n leading: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n dense: false,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 8.0, 24.0, 56.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 72.0 + 8.0, 24.0, 56.0));\n\n \/\/ Dense Three line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n isThreeLine: true,\n dense: true,\n ),\n ListTile(\n leading: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n isThreeLine: true,\n dense: true,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 16.0, 24.0, 48.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 76.0 + 16.0, 24.0, 48.0));\n\n \/\/ Non-dense Three line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n leading: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n isThreeLine: true,\n dense: false,\n ),\n ListTile(\n leading: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n isThreeLine: true,\n dense: false,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 16.0, 24.0, 56.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 88.0 + 16.0, 24.0, 56.0));\n });\n\n testWidgets('ListTile trailing icon height does not exceed ListTile height', (WidgetTester tester) async {\n \/\/ regression test for https:\/\/github.com\/flutter\/flutter\/issues\/28765\n const SizedBox oversizedWidget = SizedBox(height: 80.0, width: 24.0, child: Placeholder());\n\n \/\/ Dense One line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n trailing: oversizedWidget,\n title: Text('A'),\n dense: true,\n ),\n ListTile(\n trailing: oversizedWidget,\n title: Text('B'),\n dense: true,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 0, 24.0, 48.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 48.0, 24.0, 48.0));\n\n \/\/ Non-dense One line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n trailing: oversizedWidget,\n title: Text('A'),\n dense: false,\n ),\n ListTile(\n trailing: oversizedWidget,\n title: Text('B'),\n dense: false,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 0.0, 24.0, 56.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 56.0, 24.0, 56.0));\n\n \/\/ Dense Two line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n trailing: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n dense: true,\n ),\n ListTile(\n trailing: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n dense: true,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 8.0, 24.0, 48.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 64.0 + 8.0, 24.0, 48.0));\n\n \/\/ Non-dense Two line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n trailing: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n dense: false,\n ),\n ListTile(\n trailing: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n dense: false,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 8.0, 24.0, 56.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 72.0 + 8.0, 24.0, 56.0));\n\n \/\/ Dense Three line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n trailing: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n isThreeLine: true,\n dense: true,\n ),\n ListTile(\n trailing: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n isThreeLine: true,\n dense: true,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 16.0, 24.0, 48.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 76.0 + 16.0, 24.0, 48.0));\n\n \/\/ Non-dense Three line\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: const [\n ListTile(\n trailing: oversizedWidget,\n title: Text('A'),\n subtitle: Text('A'),\n isThreeLine: true,\n dense: false,\n ),\n ListTile(\n trailing: oversizedWidget,\n title: Text('B'),\n subtitle: Text('B'),\n isThreeLine: true,\n dense: false,\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 16.0, 24.0, 56.0));\n expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 88.0 + 16.0, 24.0, 56.0));\n });\n\n testWidgets('ListTile only accepts focus when enabled', (WidgetTester tester) async {\n final GlobalKey childKey = GlobalKey();\n\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: [\n ListTile(\n title: Text('A', key: childKey),\n dense: true,\n enabled: true,\n onTap: () {},\n ),\n ],\n ),\n ),\n ),\n );\n await tester.pump(); \/\/ Let the focus take effect.\n\n final FocusNode tileNode = Focus.of(childKey.currentContext);\n tileNode.requestFocus();\n await tester.pump(); \/\/ Let the focus take effect.\n expect(Focus.of(childKey.currentContext, nullOk: true).hasPrimaryFocus, isTrue);\n\n expect(tileNode.hasPrimaryFocus, isTrue);\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: [\n ListTile(\n title: Text('A', key: childKey),\n dense: true,\n enabled: false,\n onTap: () {},\n ),\n ],\n ),\n ),\n ),\n );\n\n expect(tester.binding.focusManager.primaryFocus, isNot(equals(tileNode)));\n expect(Focus.of(childKey.currentContext, nullOk: true).hasPrimaryFocus, isFalse);\n });\n\n testWidgets('ListTile can autofocus unless disabled.', (WidgetTester tester) async {\n final GlobalKey childKey = GlobalKey();\n\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: [\n ListTile(\n title: Text('A', key: childKey),\n dense: true,\n enabled: true,\n autofocus: true,\n onTap: () {},\n ),\n ],\n ),\n ),\n ),\n );\n\n await tester.pump();\n expect(Focus.of(childKey.currentContext, nullOk: true).hasPrimaryFocus, isTrue);\n\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: ListView(\n children: [\n ListTile(\n title: Text('A', key: childKey),\n dense: true,\n enabled: false,\n autofocus: true,\n onTap: () {},\n ),\n ],\n ),\n ),\n ),\n );\n\n await tester.pump();\n expect(Focus.of(childKey.currentContext, nullOk: true).hasPrimaryFocus, isFalse);\n });\n\n testWidgets('ListTile is focusable and has correct focus color', (WidgetTester tester) async {\n final FocusNode focusNode = FocusNode(debugLabel: 'ListTile');\n tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;\n const Key tileKey = Key('listTile');\n Widget buildApp({bool enabled = true}) {\n return MaterialApp(\n home: Material(\n child: Center(\n child: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {\n return Container(\n width: 100,\n height: 100,\n color: Colors.white,\n child: ListTile(\n key: tileKey,\n onTap: enabled ? () {} : null,\n focusColor: Colors.orange[500],\n autofocus: true,\n focusNode: focusNode,\n ),\n );\n }),\n ),\n ),\n );\n }\n await tester.pumpWidget(buildApp());\n\n await tester.pumpAndSettle();\n expect(focusNode.hasPrimaryFocus, isTrue);\n expect(\n Material.of(tester.element(find.byKey(tileKey))),\n paints\n ..rect(\n color: Colors.orange[500],\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0),\n )\n ..rect(\n color: const Color(0xffffffff),\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0),\n ),\n );\n\n \/\/ Check when the list tile is disabled.\n await tester.pumpWidget(buildApp(enabled: false));\n await tester.pumpAndSettle();\n expect(focusNode.hasPrimaryFocus, isFalse);\n expect(\n Material.of(tester.element(find.byKey(tileKey))),\n paints\n ..rect(\n color: const Color(0xffffffff),\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0)),\n );\n });\n\n testWidgets('ListTile can be hovered and has correct hover color', (WidgetTester tester) async {\n tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;\n const Key tileKey = Key('ListTile');\n Widget buildApp({bool enabled = true}) {\n return MaterialApp(\n home: Material(\n child: Center(\n child: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {\n return Container(\n width: 100,\n height: 100,\n color: Colors.white,\n child: ListTile(\n key: tileKey,\n onTap: enabled ? () {} : null,\n hoverColor: Colors.orange[500],\n autofocus: true,\n ),\n );\n }),\n ),\n ),\n );\n }\n await tester.pumpWidget(buildApp());\n\n await tester.pump();\n await tester.pumpAndSettle();\n expect(\n Material.of(tester.element(find.byKey(tileKey))),\n paints\n ..rect(\n color: const Color(0x1f000000),\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0))\n ..rect(\n color: const Color(0xffffffff),\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0)),\n );\n\n \/\/ Start hovering\n final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);\n addTearDown(gesture.removePointer);\n await gesture.moveTo(tester.getCenter(find.byKey(tileKey)));\n\n await tester.pumpWidget(buildApp());\n await tester.pump();\n await tester.pumpAndSettle();\n expect(\n Material.of(tester.element(find.byKey(tileKey))),\n paints\n ..rect(\n color: const Color(0x1f000000),\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0))\n ..rect(\n color: Colors.orange[500],\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0))\n ..rect(\n color: const Color(0xffffffff),\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0)),\n );\n\n await tester.pumpWidget(buildApp(enabled: false));\n await tester.pump();\n await tester.pumpAndSettle();\n expect(\n Material.of(tester.element(find.byKey(tileKey))),\n paints\n ..rect(\n color: Colors.orange[500],\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0))\n ..rect(\n color: const Color(0xffffffff),\n rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0)),\n );\n });\n\n testWidgets('ListTile can be triggered by keyboard shortcuts', (WidgetTester tester) async {\n tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;\n const Key tileKey = Key('ListTile');\n bool tapped = false;\n Widget buildApp({bool enabled = true}) {\n return MaterialApp(\n home: Material(\n child: Center(\n child: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {\n return Container(\n width: 200,\n height: 100,\n color: Colors.white,\n child: ListTile(\n key: tileKey,\n onTap: enabled ? () {\n setState((){\n tapped = true;\n });\n } : null,\n hoverColor: Colors.orange[500],\n autofocus: true,\n ),\n );\n }),\n ),\n ),\n );\n }\n\n await tester.pumpWidget(buildApp());\n await tester.pumpAndSettle();\n\n await tester.sendKeyEvent(LogicalKeyboardKey.space);\n await tester.pumpAndSettle();\n\n expect(tapped, isTrue);\n });\n\n testWidgets('ListTile responds to density changes.', (WidgetTester tester) async {\n const Key key = Key('test');\n Future buildTest(VisualDensity visualDensity) async {\n return await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: Center(\n child: ListTile(\n key: key,\n onTap: () {},\n autofocus: true,\n visualDensity: visualDensity,\n ),\n ),\n ),\n ),\n );\n }\n\n await buildTest(const VisualDensity());\n final RenderBox box = tester.renderObject(find.byKey(key));\n await tester.pumpAndSettle();\n expect(box.size, equals(const Size(800, 56)));\n\n await buildTest(const VisualDensity(horizontal: 3.0, vertical: 3.0));\n await tester.pumpAndSettle();\n expect(box.size, equals(const Size(800, 68)));\n\n await buildTest(const VisualDensity(horizontal: -3.0, vertical: -3.0));\n await tester.pumpAndSettle();\n expect(box.size, equals(const Size(800, 44)));\n\n await buildTest(const VisualDensity(horizontal: 3.0, vertical: -3.0));\n await tester.pumpAndSettle();\n expect(box.size, equals(const Size(800, 44)));\n });\n\n testWidgets('ListTile changes mouse cursor when hovered', (WidgetTester tester) async {\n \/\/ Test ListTile() constructor\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: Center(\n child: MouseRegion(\n cursor: SystemMouseCursors.forbidden,\n child: ListTile(\n onTap: () {},\n mouseCursor: SystemMouseCursors.text,\n ),\n ),\n ),\n ),\n ),\n );\n\n final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse, pointer: 1);\n await gesture.addPointer(location: tester.getCenter(find.byType(ListTile)));\n addTearDown(gesture.removePointer);\n\n await tester.pump();\n\n expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text);\n\n \/\/ Test default cursor\n await tester.pumpWidget(\n MaterialApp(\n home: Material(\n child: Center(\n child: MouseRegion(\n cursor: SystemMouseCursors.forbidden,\n child: ListTile(\n onTap: () {},\n ),\n ),\n ),\n ),\n ),\n );\n\n expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.click);\n\n \/\/ Test default cursor when disabled\n await tester.pumpWidget(\n const MaterialApp(\n home: Material(\n child: Center(\n child: MouseRegion(\n cursor: SystemMouseCursors.forbidden,\n child: ListTile(\n enabled: false,\n ),\n ),\n ),\n ),\n ),\n );\n\n expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic);\n });\n}\n","avg_line_length":36.1070959264,"max_line_length":155,"alphanum_fraction":0.5459375853} {"size":2178,"ext":"dart","lang":"Dart","max_stars_count":2.0,"content":"\/\/ Copyright 2022 The Flutter team. All rights reserved.\n\/\/ Use of this source code is governed by a BSD-style license that can be\n\/\/ found in the LICENSE file.\n\nimport 'dart:io';\n\nimport 'package:flutter\/foundation.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter_layout_grid\/flutter_layout_grid.dart';\nimport 'package:flutter_riverpod\/flutter_riverpod.dart';\nimport 'package:window_size\/window_size.dart';\n\nvoid main() {\n if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {\n WidgetsFlutterBinding.ensureInitialized();\n setWindowTitle('Simplistic Calculator');\n }\n\n runApp(\n const ProviderScope(\n child: CalculatorApp(),\n ),\n );\n}\n\n@immutable\nclass CalculatorState {\n const CalculatorState({\n required this.buffer,\n required this.error,\n });\n\n final String buffer;\n final String error;\n\n CalculatorState copyWith({\n String? buffer,\n String? error,\n }) =>\n CalculatorState(\n buffer: buffer ?? this.buffer,\n error: error ?? this.error,\n );\n}\n\nclass CalculatorEngine extends StateNotifier {\n CalculatorEngine()\n : super(\n const CalculatorState(\n buffer: '0',\n error: '',\n ),\n );\n\n void addToBuffer(String str) {\n state = state.copyWith(\n buffer: state.buffer + str,\n error: '',\n );\n }\n}\n\nfinal calculatorStateProvider =\n StateNotifierProvider(\n (_) => CalculatorEngine());\n\nclass CalculatorApp extends ConsumerWidget {\n const CalculatorApp({Key? key}) : super(key: key);\n\n @override\n Widget build(BuildContext context, WidgetRef ref) {\n final state = ref.watch(calculatorStateProvider);\n\n return MaterialApp(\n debugShowCheckedModeBanner: false,\n home: Scaffold(\n body: Container(\n color: Colors.white,\n child: LayoutGrid(\n columnSizes: [1.fr],\n rowSizes: [1.fr],\n children: [\n Text(\n state.buffer,\n style: const TextStyle(fontSize: 40),\n ),\n ],\n ),\n ),\n ),\n );\n }\n}\n","avg_line_length":23.170212766,"max_line_length":80,"alphanum_fraction":0.6230486685} {"size":471,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import '..\/flute.dart';\n\n\/\/\/ The implementation of [Flute].\n\/\/\/\n\/\/\/ We use it as a private class because it is not optimal to have multiple\n\/\/\/ Flute classes.\nclass _Flute with FluteFunctions {}\n\n\/\/\/ The root of [Flute] library's utilities.\n\/\/\/\n\/\/\/ This class has shortcuts for routing, small utilities of context like\n\/\/\/ size of the device and has usage with widgets like show bottom modal sheet.\n\/\/ ignore: non_constant_identifier_names\nfinal _Flute Flute = _Flute();\n","avg_line_length":31.4,"max_line_length":79,"alphanum_fraction":0.7303609342} {"size":336,"ext":"dart","lang":"Dart","max_stars_count":3.0,"content":"import 'flat_cache.dart';\n\nclass FifoCache extends FlatMapCache {\n final int _cacheSize;\n\n FifoCache(this._cacheSize);\n\n @override\n V putIfAbsent(K key, V Function() ifAbsent) {\n final result = super.putIfAbsent(key, ifAbsent);\n if (length > _cacheSize) {\n remove(keys.first);\n }\n\n return result;\n }\n}\n","avg_line_length":18.6666666667,"max_line_length":52,"alphanum_fraction":0.6607142857} {"size":2612,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/cupertino.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter_modular\/flutter_modular.dart';\nimport 'package:flutter_progress_button\/flutter_progress_button.dart';\n\nimport 'colors.dart';\nimport 'loading.dart';\nimport 'screen.dart';\n\nclass DefaultButton extends StatelessWidget {\n final String buttonCaption;\n final Function functionCallback;\n final Color colorButton;\n final Color colorButtonBorder;\n final Color colorText;\n final double borderRadius;\n final Widget icon;\n final double width;\n final double height;\n final ProgressButtonType typeButton;\n final ProgressButtonState typeButtonState;\n\n const DefaultButton(\n this.buttonCaption,\n this.functionCallback, {\n this.colorButton = AppColors.secondary,\n this.colorText = AppColors.whiteColor,\n this.colorButtonBorder = AppColors.whiteColor,\n this.icon,\n this.width,\n this.height = 140.0,\n this.borderRadius = 50.0,\n this.typeButton = ProgressButtonType.Raised,\n this.typeButtonState = ProgressButtonState.Default,\n });\n\n @override\n Widget build(BuildContext context) {\n final screen = Modular.get();\n\n return ProgressButton(\n defaultWidget: icon != null\n ? Row(\n mainAxisAlignment: MainAxisAlignment.center,\n crossAxisAlignment: CrossAxisAlignment.center,\n children: [\n Container(\n padding: EdgeInsets.only(right: 5),\n child: this.icon,\n ),\n Container(\n child: Text(\n this.buttonCaption,\n textAlign: TextAlign.center,\n style: TextStyle(\n color: this.colorText,\n fontSize: screen.setSp(38),\n fontWeight: FontWeight.bold,\n ),\n ),\n )\n ],\n )\n : Text(\n this.buttonCaption,\n textAlign: TextAlign.center,\n style: TextStyle(\n color: this.colorText,\n fontSize: screen.setSp(38),\n fontWeight: FontWeight.bold,\n ),\n ),\n onPressed: this.functionCallback,\n color: this.colorButton,\n \/\/colorBorder: this.colorButtonBorder,\n height: screen.setHeight(this.height),\n width: this.width,\n borderRadius: this.borderRadius,\n animate: true,\n type: this.typeButton,\n progressWidget: ThreeSizeDot(),\n progressButtonState: this.typeButtonState,\n );\n }\n}\n","avg_line_length":30.3720930233,"max_line_length":70,"alphanum_fraction":0.604517611} {"size":3040,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'package:flutter\/material.dart';\nimport 'package:my_milton\/services\/google_oauth.dart';\nimport 'package:my_milton\/screens\/home\/home.dart';\n\nclass LoginPage extends StatefulWidget {\n LoginPage({Key key, this.errorMessage}) : super(key: key);\n final String errorMessage;\n\n @override\n _LoginState createState() => _LoginState();\n}\n\nclass _LoginState extends State {\n @override\n Widget build(BuildContext context) {\n print(\"building the login page\");\n return Container(\n decoration: BoxDecoration(\n gradient: LinearGradient(\n colors: [Color(0xFF2F80ED), Color(0xFF6dd5ed)],\n begin: Alignment.topCenter,\n end: Alignment.bottomCenter),\n ),\n child: Column(\n mainAxisAlignment: MainAxisAlignment.center,\n children: [\n Padding(\n padding: const EdgeInsets.only(bottom: 50.0),\n child: Image(image: AssetImage(\"assets\/images\/myMiltonSplash.png\")),\n ),\n SizedBox(\n width: 300,\n child: Padding(\n padding: const EdgeInsets.all(10.0),\n child: MaterialButton(\n onPressed: () {\n signInWithGoogle().then((id) {\n\/\/ if(id.username.endsWith(\"milton.edu\")) {\n print(id.username + \" is the newly logged in id!\");\n return MyHomePage(\n title: \"MyMilton\",\n );\n });\n },\n splashColor: Colors.cyan,\n color: Colors.white,\n elevation: 2,\n shape: RoundedRectangleBorder(\n borderRadius: BorderRadius.all(Radius.circular(5.0)),\n ),\n child: Padding(\n padding: const EdgeInsets.only(\n top: 18.0, right: 20.0, left: 10, bottom: 18.0),\n child: Row(\n mainAxisAlignment: MainAxisAlignment.start,\n children: [\n Image(\n image: AssetImage(\"assets\/images\/google-logo.png\"),\n height: 20,\n ),\n Padding(\n padding: const EdgeInsets.only(left: 30.0),\n child: Text(\n \"Sign in with Google\",\n style: TextStyle(\n fontSize: 15,\n fontWeight: FontWeight.bold,\n color: Colors.grey),\n ),\n ),\n ],\n ),\n )),\n ),\n ),\n widget.errorMessage != null\n ? Text(\n widget.errorMessage,\n style: TextStyle(color: Colors.red),\n )\n : Text(\"\")\n ],\n ),\n );\n }\n}\n","avg_line_length":34.9425287356,"max_line_length":80,"alphanum_fraction":0.4490131579} {"size":257,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ title and value \uc758 \uacb0\uacfc\ub97c \ub2f4\ub294 \ud074\ub798\uc2a4\nclass TitleAndValueResult {\n String title;\n String value;\n\n @override\n String toString() {\n var sb = StringBuffer();\n sb.writeln('title = $title');\n sb.writeln('value = $value');\n\n return sb.toString();\n }\n}\n","avg_line_length":17.1333333333,"max_line_length":33,"alphanum_fraction":0.626459144} {"size":463,"ext":"dart","lang":"Dart","max_stars_count":26.0,"content":"\/\/ Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file\n\/\/ for details. All rights reserved. Use of this source code is governed by a\n\/\/ BSD-style license that can be found in the LICENSE file.\n\n\/\/\/ An exception class that's thrown when a path operation is unable to be\n\/\/\/ computed accurately.\nclass PathException implements Exception {\n String message;\n\n PathException(this.message);\n\n String toString() => \"PathException: $message\";\n}\n","avg_line_length":33.0714285714,"max_line_length":77,"alphanum_fraction":0.7451403888} {"size":371,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"import 'package:flutter\/foundation.dart';\nimport 'package:flutter\/services.dart';\n\nclass MediationTest {\n static const MethodChannel _channel = const MethodChannel('mediation_test');\n\n static void presentTestSuite() async {\n try {\n await _channel.invokeMethod('presentTestSuite');\n } on PlatformException catch (e) {\n debugPrint(e.message);\n }\n }\n}\n","avg_line_length":24.7333333333,"max_line_length":78,"alphanum_fraction":0.7169811321} {"size":4753,"ext":"dart","lang":"Dart","max_stars_count":4.0,"content":"\/*\n * Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\/\n\nimport 'package:beagle\/beagle.dart';\nimport 'package:flutter\/material.dart';\nimport 'package:flutter_test\/flutter_test.dart';\nimport 'package:mocktail\/mocktail.dart';\n\nimport 'mock.dart';\n\ntypedef RetryFn = Future Function();\n\nclass RootNavigatorExpectations {\n RootNavigatorExpectations({\n required this.mocks,\n required WidgetTester tester,\n this.route,\n }) : navigatorState = tester.state(find.byType(RootNavigator));\n\n final RootNavigatorMocks mocks;\n final BeagleRoute? route;\n final RootNavigatorState navigatorState;\n\n void _shouldCreateStackNavigator([String? customController]) {\n verify(() => mocks.stackNavigatorFactory(\n initialRoute: route,\n screenBuilder: mocks.screenBuilder,\n rootNavigator: navigatorState,\n logger: mocks.logger,\n viewClient: mocks.beagleService.viewClient,\n controller: customController == null\n ? mocks.beagleService.defaultNavigationController\n : mocks.beagleService.navigationControllers[customController] as NavigationController,\n )).called(1);\n }\n\n void shouldCreateStackNavigatorWithDefaultController() {\n _shouldCreateStackNavigator();\n }\n\n void shouldCreateStackNavigatorWithCustomController(String customController) {\n _shouldCreateStackNavigator(customController);\n }\n\n void shouldUpdateHistoryByAddingStack() {\n expect(navigatorState.getHistory(), [...mocks.initialPages, mocks.lastStackNavigator]);\n }\n\n void shouldUpdateHistoryByRemovingStack() {\n final expectedHistory = [...mocks.initialPages];\n expectedHistory.removeLast();\n expect(navigatorState.getHistory(), expectedHistory);\n }\n\n void shouldUpdateHistoryByReplacingStack() {\n final expectedHistory = [...mocks.initialPages];\n expectedHistory.removeLast();\n expectedHistory.add(mocks.lastStackNavigator);\n expect(navigatorState.getHistory(), expectedHistory);\n }\n\n void shouldUpdateHistoryByResettingStacks() {\n expect(navigatorState.getHistory(), [mocks.lastStackNavigator]);\n }\n\n void shouldPushNewRoute() {\n verify(() => mocks.rootNavigatorObserver.didPush(any(), any())).called(mocks.initialPages.length + 1);\n }\n\n void shouldPushNewRoutesWithCorrectNames(int times) {\n final verified = verify(() => mocks.rootNavigatorObserver.didPush(captureAny(), any()));\n verified.called(mocks.initialPages.length + times);\n final indexes = verified.captured.map((route) {\n final exp = RegExp(r\"beagle-root-navigator-stack-(\\d+)\");\n final routeName = (route as Route).settings.name as String;\n final match = exp.firstMatch(routeName);\n expect(match == null, false);\n return int.parse(match?.group(1) as String);\n }).toList();\n \/\/ should be sequential\n for (int i = 0; i < indexes.length; i++) {\n expect(indexes[i], indexes[0] + i);\n }\n }\n\n void shouldReplaceLastRouteWithNew() {\n verify(() => mocks.rootNavigatorObserver.didReplace(\n newRoute: any(named: 'newRoute'),\n oldRoute: any(named: 'oldRoute'),\n )).called(1);\n }\n\n void shouldRemoveEveryRoute() {\n verify(() => mocks.rootNavigatorObserver.didRemove(any(), any())).called(mocks.initialPages.length);\n }\n\n void shouldPopRoute() {\n verify(() => mocks.rootNavigatorObserver.didPop(any(), any())).called(1);\n }\n\n void shouldPopRootNavigator() {\n verify(() => mocks.topNavigatorObserver.didPop(any(), any())).called(1);\n }\n\n void shouldRenderNewStackNavigator() {\n expect(find.byWidget(mocks.lastStackNavigator), findsOneWidget);\n }\n\n void shouldRenderPreviousStackNavigator() {\n expect(find.byWidget(mocks.initialPages.elementAt(mocks.initialPages.length - 2)), findsOneWidget);\n }\n\n void shouldPushViewToCurrentStack(BeagleRoute route) {\n verify(() => mocks.initialPages.last.pushView(route, mocks.lastStackNavigator.buildContext)).called(1);\n }\n\n void shouldPopViewFromCurrentStack() {\n verify(() => mocks.initialPages.last.popView()).called(1);\n }\n\n void shouldPopToViewOfCurrentStack(String viewName) {\n verify(() => mocks.initialPages.last.popToView(viewName)).called(1);\n }\n}\n","avg_line_length":34.4420289855,"max_line_length":107,"alphanum_fraction":0.7168104355} {"size":1380,"ext":"dart","lang":"Dart","max_stars_count":28.0,"content":"import 'package:flutter\/material.dart';\nimport 'package:one_widget_per_day\/resources\/strings.dart';\nimport 'package:one_widget_per_day\/ui\/widgets\/come_back_button.dart';\nimport 'package:one_widget_per_day\/ui\/widgets\/title.dart';\n\nclass PositionedScreen extends StatefulWidget {\n @override\n _PositionedScreenState createState() => _PositionedScreenState();\n}\n\nclass _PositionedScreenState extends State {\n @override\n Widget build(BuildContext context) {\n return SafeArea(\n child: Scaffold(\n backgroundColor: Colors.black,\n body: SingleChildScrollView(\n scrollDirection: Axis.vertical,\n child: Center(\n child: Padding(\n padding: EdgeInsets.only(top: 20, left: 20, right: 20),\n child: Column(\n children: [\n Row(\n children: [\n ComeBackButton(),\n SizedBox(width: 30),\n TitleFont(\n fontSize: 50,\n text: Strings.CATALOG_POSITIONED,\n ),\n ],\n ),\n Image.asset(\n 'assets\/construcao.png',\n height: 400,\n ),\n ],\n ),\n ),\n ),\n ),\n ),\n );\n }\n}\n","avg_line_length":29.3617021277,"max_line_length":69,"alphanum_fraction":0.5086956522} {"size":19840,"ext":"dart","lang":"Dart","max_stars_count":null,"content":"\/\/ import 'dart:io';\n\n\/\/ import 'package:flutter\/material.dart';\n\/\/ import 'package:geolocator\/geolocator.dart';\n\/\/ import 'package:provider\/provider.dart';\n\/\/ import 'package:qoqi\/src\/blocs\/account_bloc.dart';\n\/\/ import 'package:qoqi\/src\/blocs\/order_bloc.dart';\n\/\/ import 'package:qoqi\/src\/screens\/intro_screen\/intro_screen.dart';\n\/\/ import 'package:qoqi\/src\/utils\/size_config.dart';\n\/\/ import 'package:qoqi\/src\/utils\/style.dart';\n\/\/ import 'package:qoqi\/src\/widgets\/common\/app_spacer.dart';\n\/\/ import 'package:qoqi\/src\/widgets\/common\/circle_button.dart';\n\/\/ import 'package:qoqi\/src\/widgets\/common\/wide_button.dart';\n\/\/ import 'package:qoqi\/src\/widgets\/rounded_box.dart';\n\n\/\/ Future showAlertDialog({\n\/\/ @required BuildContext context,\n\/\/ final bool barrierDismissible = false,\n\/\/ final String title,\n\/\/ final TextAlign titleAlign = TextAlign.left,\n\/\/ final String subtitle,\n\/\/ final TextAlign subtitleAlign = TextAlign.left,\n\/\/ final String actionLabel = 'OK',\n\/\/ final Function onActionLabelPressed,\n\/\/ }) {\n\/\/ return _showBaseDialog(\n\/\/ context: context,\n\/\/ barrierDismissible: barrierDismissible,\n\/\/ child: Column(\n\/\/ mainAxisSize: MainAxisSize.min,\n\/\/ crossAxisAlignment: CrossAxisAlignment.stretch,\n\/\/ children: [\n\/\/ if (title != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 16.scw),\n\/\/ child: Text(\n\/\/ title,\n\/\/ style: AppTextStyle.bodyText3.copyWith(\n\/\/ fontWeight: FontWeight.bold,\n\/\/ ),\n\/\/ textAlign: titleAlign,\n\/\/ ),\n\/\/ ),\n\/\/ if (subtitle != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 16.scw),\n\/\/ child: Text(\n\/\/ subtitle,\n\/\/ style: AppTextStyle.bodyText1,\n\/\/ textAlign: subtitleAlign,\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(16.0),\n\/\/ _buildActionButton(actionLabel, true, () {\n\/\/ if (onActionLabelPressed != null) {\n\/\/ onActionLabelPressed();\n\/\/ } else {\n\/\/ Navigator.pop(context);\n\/\/ }\n\/\/ }),\n\/\/ ],\n\/\/ ),\n\/\/ );\n\/\/ }\n\n\/\/ Future showConfirmDialog({\n\/\/ @required BuildContext context,\n\/\/ final String title,\n\/\/ final TextAlign titleAlign = TextAlign.left,\n\/\/ final String subtitle,\n\/\/ final TextAlign subtitleAlign = TextAlign.left,\n\/\/ final bool barrierDismissible = false,\n\/\/ final String positiveLabel = 'Ya',\n\/\/ final String negativeLabel = 'Tidak',\n\/\/ final bool emphasizePositif = false,\n\/\/ }) {\n\/\/ return _showBaseDialog(\n\/\/ context: context,\n\/\/ barrierDismissible: barrierDismissible,\n\/\/ child: Column(\n\/\/ crossAxisAlignment: CrossAxisAlignment.stretch,\n\/\/ children: [\n\/\/ if (title != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 16.scw),\n\/\/ child: Text(\n\/\/ title,\n\/\/ style: AppTextStyle.bodyText3.copyWith(\n\/\/ fontWeight: FontWeight.bold,\n\/\/ ),\n\/\/ textAlign: titleAlign,\n\/\/ ),\n\/\/ ),\n\/\/ if (subtitle != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 16.scw),\n\/\/ child: Text(\n\/\/ subtitle,\n\/\/ style: AppTextStyle.bodyText1,\n\/\/ textAlign: subtitleAlign,\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(16.0),\n\/\/ Expanded(\n\/\/ child: Row(\n\/\/ children: [\n\/\/ Expanded(\n\/\/ child: _buildActionButton(negativeLabel, !emphasizePositif, () {\n\/\/ Navigator.pop(context, false);\n\/\/ }),\n\/\/ ),\n\/\/ SizedBox(width: 10.0),\n\/\/ Expanded(\n\/\/ child: _buildActionButton(positiveLabel, emphasizePositif, () {\n\/\/ Navigator.pop(context, true);\n\/\/ }),\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ );\n\/\/ }\n\n\/\/ Widget _buildActionButton(String label, bool emphasize, Function onPressed) {\n\/\/ return WideButton(\n\/\/ flatButton: true,\n\/\/ color: emphasize ? AppColor.kButtonPrimaryBackground : Colors.transparent,\n\/\/ borderSide: BorderSide(\n\/\/ width: 1.0,\n\/\/ color: AppColor.kBrandColor,\n\/\/ ),\n\/\/ circularRadius: 10.0,\n\/\/ child: Text(\n\/\/ label,\n\/\/ style: AppTextStyle.bodyText1.copyWith(\n\/\/ color: emphasize ? AppColor.kPrimaryText : AppColor.kBrandText,\n\/\/ fontWeight: emphasize ? FontWeight.w900 : FontWeight.normal,\n\/\/ ),\n\/\/ ),\n\/\/ onPressed: onPressed,\n\/\/ );\n\/\/ }\n\n\/\/ Future showSuccessDialog({\n\/\/ @required BuildContext context,\n\/\/ final bool barrierDismissible = false,\n\/\/ final String title,\n\/\/ final String subtitle,\n\/\/ }) {\n\/\/ return _showBaseTimedDialog(\n\/\/ context: context,\n\/\/ barrierDismissible: barrierDismissible,\n\/\/ assetName: 'assets\/images\/animated_success.gif',\n\/\/ title: title,\n\/\/ subtitle: subtitle,\n\/\/ );\n\/\/ }\n\n\/\/ Future showPaymentPaymentDialog({\n\/\/ @required BuildContext context,\n\/\/ }) {\n\/\/ return _showBaseTimedDialog(\n\/\/ context: context,\n\/\/ barrierDismissible: false,\n\/\/ assetName: 'assets\/images\/animated_payment_success.gif',\n\/\/ title: 'Pembayaran Berhasil!',\n\/\/ subtitle: 'Pesanan Kamu sudah dikonfirmasi',\n\/\/ );\n\/\/ }\n\n\/\/ Future showNetworkImageDialog({\n\/\/ @required BuildContext context,\n\/\/ String imageUrl,\n\/\/ }) {\n\/\/ return showDialog(\n\/\/ context: context,\n\/\/ builder: (BuildContext context) {\n\/\/ return GestureDetector(\n\/\/ onTap: () {\n\/\/ Navigator.pop(context);\n\/\/ },\n\/\/ child: Stack(\n\/\/ children: [\n\/\/ Positioned(\n\/\/ top: 12.scw,\n\/\/ right: 12.scw,\n\/\/ child: CircleButton(\n\/\/ diameter: 32.scw,\n\/\/ backgroundColor: AppColor.kNavigationButtonBackground,\n\/\/ splashColor: AppColor.kNavigationButtonBackground,\n\/\/ child: Icon(\n\/\/ Icons.close,\n\/\/ color: Colors.white,\n\/\/ size: 22.scs,\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ Center(\n\/\/ child: Container(\n\/\/ padding: EdgeInsets.symmetric(horizontal: 16.scw),\n\/\/ color: Colors.transparent,\n\/\/ child: ClipRRect(\n\/\/ borderRadius: BorderRadius.circular(10.0),\n\/\/ child: Image.network(imageUrl),\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ );\n\/\/ },\n\/\/ );\n\/\/ }\n\n\/\/ Future showNoGpsPermissionError(BuildContext context) async {\n\/\/ final openSetting = await showConfirmDialog(\n\/\/ context: context,\n\/\/ title: 'Lokasi kamu tidak terdeteksi',\n\/\/ subtitle:\n\/\/ 'Pengaturan privasi ponsel kamu menghalangi aplikasi untuk mendeteksi lokasi. Ubah pengaturan privasi poselmu dulu, ya!',\n\/\/ titleAlign: TextAlign.center,\n\/\/ subtitleAlign: TextAlign.center,\n\/\/ positiveLabel: 'Pengaturan',\n\/\/ negativeLabel: Platform.isAndroid ? 'Keluar' : 'Lanjutkan',\n\/\/ emphasizePositif: true,\n\/\/ );\n\n\/\/ if (openSetting) {\n\/\/ await Geolocator.openAppSettings();\n\/\/ }\n\/\/ }\n\n\/\/ Future showErrorDialog(BuildContext context, String errorMessage,\n\/\/ {Function onRetry}) async {\n\/\/ String image, title, subtitle, buttonText;\n\/\/ Function onButtonPressed;\n\n\/\/ if (errorMessage.contains('internet')) {\n\/\/ image = 'assets\/images\/error_internet.png';\n\/\/ title = 'Duh, internet putus, nih';\n\/\/ subtitle = 'Periksa koneksi kamu untuk melanjutkan';\n\/\/ buttonText = 'Coba lagi';\n\/\/ } else if (errorMessage.contains('Unauthorised')) {\n\/\/ image = 'assets\/images\/error_unauthorised.png';\n\/\/ title = 'Yuk, masuk lagi!';\n\/\/ subtitle =\n\/\/ 'Kamu keluar dari aplikasi karena satu akun hanya bisa digunakan di satu handphone';\n\/\/ buttonText = 'Masuk';\n\/\/ } else {\n\/\/ image = 'assets\/images\/error_system.png';\n\/\/ title = 'Maaf, halaman ini error';\n\/\/ subtitle = 'Silahkan tunggu beberapa saat lagi';\n\/\/ buttonText = 'Coba lagi';\n\/\/ }\n\n\/\/ if (errorMessage.contains('Unauthorised')) {\n\/\/ onButtonPressed = () {\n\/\/ final accountBloc = Provider.of(context, listen: false);\n\/\/ final orderBloc = Provider.of(context, listen: false);\n\/\/ accountBloc.logout();\n\/\/ orderBloc.initOrderData();\n\/\/ Navigator.pushNamedAndRemoveUntil(\n\/\/ context,\n\/\/ IntroScreen.kRouteName,\n\/\/ (r) => false,\n\/\/ );\n\/\/ };\n\/\/ } else {\n\/\/ onButtonPressed = () {\n\/\/ Navigator.pop(context);\n\/\/ if (onRetry != null) {\n\/\/ onRetry();\n\/\/ }\n\/\/ };\n\/\/ }\n\n\/\/ await showModalBottomSheet(\n\/\/ context: context,\n\/\/ isScrollControlled: true,\n\/\/ builder: (BuildContext context) {\n\/\/ return Container(\n\/\/ padding: EdgeInsets.fromLTRB(16.scw, 2.scw, 16.scw, 16.scw),\n\/\/ decoration: BoxDecoration(\n\/\/ color: AppColor.kBottomSheetBackground,\n\/\/ borderRadius: BorderRadius.vertical(\n\/\/ top: Radius.circular(20.scw),\n\/\/ ),\n\/\/ ),\n\/\/ child: IntrinsicHeight(\n\/\/ child: Column(\n\/\/ crossAxisAlignment: CrossAxisAlignment.start,\n\/\/ children: [\n\/\/ Align(\n\/\/ child: Container(\n\/\/ width: 55.scw,\n\/\/ padding: EdgeInsets.only(top: 6.scw),\n\/\/ child: Column(\n\/\/ children: [\n\/\/ Divider(height: 4.scw, thickness: 2.0),\n\/\/ Divider(height: 4.scw, thickness: 2.0),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(20.0, usingWidth: true),\n\/\/ Align(\n\/\/ child: Image.asset(\n\/\/ image,\n\/\/ height: 150.scw,\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(20.0, usingWidth: true),\n\/\/ Text(\n\/\/ title,\n\/\/ style: AppTextStyle.headline6.copyWith(\n\/\/ fontWeight: FontWeight.bold,\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(4.0, usingWidth: true),\n\/\/ Text(\n\/\/ subtitle,\n\/\/ style: AppTextStyle.bodyText1,\n\/\/ ),\n\/\/ AppSpacer.vSpacing(30.0, usingWidth: true),\n\/\/ WideButton(\n\/\/ flatButton: true,\n\/\/ circularRadius: 10.0,\n\/\/ child: Padding(\n\/\/ padding: EdgeInsets.all(4.scw),\n\/\/ child: Text(\n\/\/ buttonText,\n\/\/ style: AppTextStyle.button.copyWith(\n\/\/ fontWeight: FontWeight.bold,\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ onPressed: onButtonPressed,\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ );\n\/\/ },\n\/\/ );\n\n\/\/ if (onRetry != null) {\n\/\/ onRetry();\n\/\/ }\n\/\/ }\n\n\/\/ Future _showBaseDialog({\n\/\/ @required BuildContext context,\n\/\/ final bool barrierDismissible = false,\n\/\/ Widget child,\n\/\/ }) {\n\/\/ return showDialog(\n\/\/ context: context,\n\/\/ barrierDismissible: barrierDismissible,\n\/\/ builder: (BuildContext context) {\n\/\/ return Dialog(\n\/\/ elevation: 0.0,\n\/\/ backgroundColor: Colors.transparent,\n\/\/ child: RoundedBox(\n\/\/ contentPadding: EdgeInsets.all(16.scw),\n\/\/ color: AppColor.kPrimaryBackground,\n\/\/ child: IntrinsicHeight(child: child),\n\/\/ ),\n\/\/ );\n\/\/ },\n\/\/ );\n\/\/ }\n\n\/\/ Future _showBaseTimedDialog({\n\/\/ @required BuildContext context,\n\/\/ final bool barrierDismissible = false,\n\/\/ final String assetName,\n\/\/ final String title,\n\/\/ final String subtitle,\n\/\/ }) {\n\/\/ return showDialog(\n\/\/ context: context,\n\/\/ barrierDismissible: barrierDismissible,\n\/\/ builder: (context) {\n\/\/ imageCache.clear();\n\/\/ Future.delayed(Duration(seconds: 3), () {\n\/\/ Navigator.pop(context);\n\/\/ });\n\n\/\/ return Dialog(\n\/\/ elevation: 0.0,\n\/\/ backgroundColor: Colors.transparent,\n\/\/ child: RoundedBox(\n\/\/ contentPadding: EdgeInsets.symmetric(\n\/\/ vertical: 50.scw,\n\/\/ horizontal: 16.scw,\n\/\/ ),\n\/\/ child: Column(\n\/\/ mainAxisSize: MainAxisSize.min,\n\/\/ children: [\n\/\/ Center(\n\/\/ child: Image.asset(\n\/\/ assetName,\n\/\/ height: 150.0,\n\/\/ width: 150.0,\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(30.scw),\n\/\/ if (title != null)\n\/\/ Text(\n\/\/ title,\n\/\/ textAlign: TextAlign.center,\n\/\/ style: AppTextStyle.bodyText3.copyWith(\n\/\/ fontWeight: FontWeight.bold,\n\/\/ ),\n\/\/ ),\n\/\/ if (subtitle != null)\n\/\/ Text(\n\/\/ subtitle,\n\/\/ textAlign: TextAlign.center,\n\/\/ style: AppTextStyle.bodyText2,\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ );\n\/\/ },\n\/\/ );\n\/\/ }\n\n\/\/ Future showAlertBottomSheet({\n\/\/ @required BuildContext context,\n\/\/ final bool barrierDismissible = false,\n\/\/ final String title,\n\/\/ final String image,\n\/\/ final String subtitle,\n\/\/ final String actionLabel = 'OK',\n\/\/ }) async {\n\/\/ return showModalBottomSheet(\n\/\/ context: context,\n\/\/ isScrollControlled: true,\n\/\/ builder: (BuildContext context) {\n\/\/ return Container(\n\/\/ padding: EdgeInsets.fromLTRB(16.scw, 2.scw, 16.scw, 16.scw),\n\/\/ decoration: BoxDecoration(\n\/\/ color: AppColor.kBottomSheetBackground,\n\/\/ borderRadius: BorderRadius.vertical(\n\/\/ top: Radius.circular(20.scw),\n\/\/ ),\n\/\/ ),\n\/\/ child: IntrinsicHeight(\n\/\/ child: Column(\n\/\/ crossAxisAlignment: CrossAxisAlignment.start,\n\/\/ children: [\n\/\/ Align(\n\/\/ child: Container(\n\/\/ width: 55.scw,\n\/\/ padding: EdgeInsets.only(top: 6.scw),\n\/\/ child: Column(\n\/\/ children: [\n\/\/ Divider(height: 4.scw, thickness: 2.0),\n\/\/ Divider(height: 4.scw, thickness: 2.0),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(20.0, usingWidth: true),\n\/\/ if (image != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 20.scw),\n\/\/ child: Align(\n\/\/ child: Image.asset(\n\/\/ image,\n\/\/ height: 150.scw,\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ if (title != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 4.scw),\n\/\/ child: Text(\n\/\/ title,\n\/\/ style: AppTextStyle.bodyText3.copyWith(\n\/\/ fontWeight: FontWeight.bold,\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ if (subtitle != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 15.scw),\n\/\/ child: Text(\n\/\/ subtitle,\n\/\/ style: AppTextStyle.bodyText1,\n\/\/ ),\n\/\/ ),\n\/\/ _buildActionButton(actionLabel, true, () {\n\/\/ Navigator.pop(context);\n\/\/ }),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ );\n\/\/ },\n\/\/ );\n\/\/ }\n\n\/\/ Future showConfirmBottomSheet({\n\/\/ @required BuildContext context,\n\/\/ final String title,\n\/\/ final String subtitle,\n\/\/ final String image,\n\/\/ final String positiveLabel = 'Ya',\n\/\/ final String negativeLabel = 'Tidak',\n\/\/ final bool emphasizePositif = false,\n\/\/ final bool isDismissible = true,\n\/\/ }) async {\n\/\/ final result = await showModalBottomSheet(\n\/\/ isDismissible: isDismissible,\n\/\/ context: context,\n\/\/ isScrollControlled: true,\n\/\/ builder: (BuildContext context) {\n\/\/ return Container(\n\/\/ padding: EdgeInsets.fromLTRB(16.scw, 2.scw, 16.scw, 16.scw),\n\/\/ decoration: BoxDecoration(\n\/\/ color: AppColor.kBottomSheetBackground,\n\/\/ borderRadius: BorderRadius.vertical(\n\/\/ top: Radius.circular(20.scw),\n\/\/ ),\n\/\/ ),\n\/\/ child: IntrinsicHeight(\n\/\/ child: Column(\n\/\/ crossAxisAlignment: CrossAxisAlignment.start,\n\/\/ children: [\n\/\/ Align(\n\/\/ child: Container(\n\/\/ width: 55.scw,\n\/\/ padding: EdgeInsets.only(top: 6.scw),\n\/\/ child: Column(\n\/\/ children: [\n\/\/ Divider(height: 4.scw, thickness: 2.0),\n\/\/ Divider(height: 4.scw, thickness: 2.0),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(20.0, usingWidth: true),\n\/\/ if (image != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 20.scw),\n\/\/ child: Align(\n\/\/ child: Image.asset(\n\/\/ image,\n\/\/ height: 150.scw,\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ if (title != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 4.scw),\n\/\/ child: Text(\n\/\/ title,\n\/\/ style: AppTextStyle.bodyText3.copyWith(\n\/\/ fontWeight: FontWeight.bold,\n\/\/ ),\n\/\/ ),\n\/\/ ),\n\/\/ if (subtitle != null)\n\/\/ Padding(\n\/\/ padding: EdgeInsets.only(bottom: 4.scw),\n\/\/ child: Text(\n\/\/ subtitle,\n\/\/ style: AppTextStyle.bodyText1,\n\/\/ ),\n\/\/ ),\n\/\/ AppSpacer.vSpacing(12.0, usingWidth: true),\n\/\/ Expanded(\n\/\/ child: Row(\n\/\/ children: [\n\/\/ Expanded(\n\/\/ child: _buildActionButton(\n\/\/ negativeLabel, !emphasizePositif, () {\n\/\/ Navigator.pop(context, false);\n\/\/ }),\n\/\/ ),\n\/\/ SizedBox(width: 10.0),\n\/\/ Expanded(\n\/\/ child: _buildActionButton(positiveLabel, emphasizePositif,\n\/\/ () {\n\/\/ Navigator.pop(context, true);\n\/\/ }),\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ ],\n\/\/ ),\n\/\/ ),\n\/\/ );\n\/\/ },\n\/\/ );\n\n\/\/ if (result != null && result == true) {\n\/\/ return true;\n\/\/ } else {\n\/\/ return false;\n\/\/ }\n\/\/ }\n","avg_line_length":32.5779967159,"max_line_length":132,"alphanum_fraction":0.4728830645} {"size":857,"ext":"dart","lang":"Dart","max_stars_count":1.0,"content":"import 'package:corona_nepal\/blocs\/affected_bloc.dart';\nimport 'package:corona_nepal\/blocs\/countries_bloc.dart';\nimport 'package:corona_nepal\/blocs\/faq_bloc.dart';\nimport 'package:corona_nepal\/blocs\/hospital_bloc.dart';\nimport 'package:corona_nepal\/blocs\/myth_bloc.dart';\nimport 'package:corona_nepal\/blocs\/nepal_bloc.dart';\nimport 'package:corona_nepal\/blocs\/news_bloc.dart';\nimport 'package:get_it\/get_it.dart';\n\nfinal locator = GetIt.instance;\nvoid setupLocators() {\n locator.registerSingleton(CountriesBloc());\n locator.registerSingleton(HospitalsBloc());\n locator.registerSingleton(FAQBloc());\n locator.registerSingleton(NewsBloc());\n locator.registerSingleton(MythBloc());\n locator.registerSingleton(StatsBloc());\n locator.registerSingleton(AffectedBloc());\n}\n","avg_line_length":42.85,"max_line_length":60,"alphanum_fraction":0.8086347725} {"size":553,"ext":"dart","lang":"Dart","max_stars_count":38.0,"content":"\/\/ Copyright (C) 2013 - 2016 Angular Dart UI authors. Please see AUTHORS.md.\n\/\/ https:\/\/github.com\/akserg\/angular.dart.ui\n\/\/ All rights reserved. Please see the LICENSE.md file.\npart of angular.ui.demo;\n\n\/**\n * Buttons demo component.\n *\/\n@Component(selector: 'buttons-demo', \n templateUrl: 'buttons\/buttons_demo.html',\n useShadowDom: false)\nclass ButtonsDemo implements ScopeAware {\n \n Scope scope;\n \n var singleModel = 1;\n \n var radioModel = 'Right';\n \n var leftModel = false;\n \n var middleModel = true;\n \n var rightModel = false;\n}","avg_line_length":22.12,"max_line_length":76,"alphanum_fraction":0.6889692586}