Commit de5d109f authored by justin's avatar justin

add analysis option

parent 942d26c7
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Specify analysis options.
#
# Google internally enforced rules. See README.md for more information,
# including a list of lints that are intentionally _not_ enforced.
# Until there are meta linter rules, each desired lint must be explicitly enabled.
# See: https://github.com/dart-lang/linter/issues/288
#
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
# See the configuration guide for more
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
#
# There are other similar analysis options files in the flutter repos,
# which should be kept in sync with this file:
#
# - analysis_options.yaml (this file)
# - packages/flutter/lib/analysis_options_user.yaml
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
# - https://github.com/flutter/engine/blob/master/analysis_options.yaml
#
# This file contains the analysis options used by Flutter tools, such as IntelliJ,
# Android Studio, and the `flutter analyze` command.
analyzer:
strong-mode:
implicit-dynamic: false
errors:
# treat missing required parameters as a warning (not a hint)
missing_required_param: warning
# treat missing returns as a warning (not a hint)
missing_return: warning
# allow having TODOs in the code
todo: ignore
# Ignore analyzer hints for updating pubspecs when using Future or
# Stream and not importing dart:async
# Please see https://github.com/flutter/flutter/pull/24528 for details.
sdk_version_async_exported_from_core: ignore
exclude:
- "bin/cache/**"
# the following two are relative to the stocks example and the flutter package respectively
# see https://github.com/dart-lang/sdk/issues/28463
- "lib/i18n/messages_*.dart"
- "lib/src/http/**"
- "example/**"
- "example_swift/**"
- "test/**"
linter:
rules:
# these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
- always_require_non_null_named_parameters
- always_specify_types
- annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
# - avoid_as # required for implicit-casts: true
- avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # we do this commonly
# - avoid_catching_errors # we do this commonly
- avoid_classes_with_only_static_members
# - avoid_double_and_int_checks # only useful when targeting JS runtime
- avoid_empty_else
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # not yet tested
- avoid_init_to_null
# - avoid_js_rounded_ints # only useful when targeting JS runtime
- avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # not yet tested
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_shadowing_type_parameters
# - avoid_returning_null # there are plenty of valid reasons to return null
# - avoid_returning_null_for_future # not yet tested
- avoid_returning_null_for_void
# - avoid_returning_this # there are plenty of valid reasons to return this
# - avoid_setters_without_getters # not yet tested
# - avoid_shadowing_type_parameters # not yet tested
# - avoid_single_cascade_in_expression_statements # not yet tested
- avoid_slow_async_io
- avoid_types_as_parameter_names
- curly_braces_in_flow_control_structures
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
# - cascade_invocations # not yet tested
# - close_sinks # not reliable enough
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not yet tested
# - diagnostic_describe_all_properties # not yet tested
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
# - file_names # not yet tested
- flutter_style_todos
- hash_and_equals
- implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type
# - join_return_with_assignment # not yet tested
- library_names
- library_prefixes
# - lines_longer_than_80_chars # not yet tested
- list_remove_unrelated_type
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
- no_adjacent_strings_in_list
- no_duplicate_case_values
- null_closures
- non_constant_identifier_names
# - null_closures # not yet tested
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
# - prefer_asserts_with_message # not yet tested
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods # not yet tested
- prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes
- prefer_equal_for_default_values
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
- prefer_final_fields
# - prefer_final_in_for_each # not yet tested
- prefer_final_locals
# - prefer_for_elements_to_map_fromIterable # not yet tested
- prefer_foreach
# - prefer_function_declarations_over_variables # not yet tested
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
# - prefer_int_literals # not yet tested
# - prefer_interpolation_to_compose_strings # not yet tested
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
# - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
# - provide_deprecation_message # not yet tested
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
- recursive_getters
- slash_for_doc_comments
# - sort_child_properties_last # not yet tested
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
- unawaited_futures
# - unawaited_futures # too many false positives
# - unnecessary_await_in_return # not yet tested
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_this
- unrelated_type_equality_checks
# - unsafe_html # not yet tested
- use_full_hex_values_for_flutter_colors
# - use_function_type_syntax_for_parameters # not yet tested
- use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- valid_regexps
# - void_checks # not yet tested
Future<Map<String,dynamic>> open(String url,{Map<String,dynamic> urlParams,Map<String,dynamic> exts}){
}
void close(String id,{Map<String,dynamic> result,Map<String,dynamic> exts}){
}
\ No newline at end of file
......@@ -31,7 +31,7 @@ class FirstRouteWidget extends StatelessWidget {
child: Text('Present second route'),
onPressed: () {
print("Present second page!");
FlutterBoost.singleton.open("second",urlParams:{"present":true}).then((Map value) {
FlutterBoost.singleton.open("second",urlParams:<dynamic,dynamic>{"present":true}).then((Map value) {
print(
"call me when page is finished. did recieve second route result $value");
});
......@@ -79,7 +79,7 @@ class SecondRouteWidget extends StatelessWidget {
BoostContainerSettings settings =
BoostContainer.of(context).settings;
FlutterBoost.singleton.close(settings.uniqueId,
result: {"result": "data from second"});
result: <dynamic,dynamic>{"result": "data from second"});
},
child: Text('Go back with result!'),
),
......@@ -195,7 +195,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("sample://nativePage", urlParams: {
.open("sample://nativePage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -212,7 +212,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("first", urlParams: {
.open("first", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -229,7 +229,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("second", urlParams: {
.open("second", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"}
}),
),
......@@ -246,7 +246,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("tab", urlParams: {
.open("tab", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"}
}),
),
......@@ -263,7 +263,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("sample://flutterPage", urlParams: {
.open("sample://flutterPage", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"}
}),
),
......@@ -277,8 +277,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (_) => PushWidget()));
Navigator.push<dynamic>(context,
MaterialPageRoute<dynamic>(builder: (_) => PushWidget()));
},
),
......@@ -292,8 +292,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (_) => PlatformRouteWidget()));
Navigator.push<dynamic>(context,
MaterialPageRoute<dynamic>(builder: (_) => PlatformRouteWidget()));
},
),
InkWell(
......
......@@ -134,7 +134,7 @@ class _TestTextFieldState extends State<TestTextField> {
if (_node.hasFocus) {
print('showBottomSheet');
_controller = Scaffold.of(context)
.showBottomSheet((BuildContext ctx) => Container(
.showBottomSheet<dynamic>((BuildContext ctx) => Container(
width: double.infinity,
height: 36.0,
color: Colors.deepPurple,
......
Future<Map<String,dynamic>> open(String url,{Map<String,dynamic> urlParams,Map<String,dynamic> exts}){
}
void close(String id,{Map<String,dynamic> result,Map<String,dynamic> exts}){
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ class SecondRouteWidget extends StatelessWidget {
BoostContainerSettings settings =
BoostContainer.of(context).settings;
FlutterBoost.singleton.close(settings.uniqueId,
result: {"result": "data from second"});
result: <dynamic,dynamic>{"result": "data from second"});
},
child: Text('Go back with result!'),
),
......@@ -102,7 +102,7 @@ class FlutterRouteWidget extends StatelessWidget {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () =>
FlutterBoost.singleton.open("sample://nativePage", urlParams: {
FlutterBoost.singleton.open("sample://nativePage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -119,7 +119,7 @@ class FlutterRouteWidget extends StatelessWidget {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () =>
FlutterBoost.singleton.open("sample://flutterPage", urlParams: {
FlutterBoost.singleton.open("sample://flutterPage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -133,8 +133,8 @@ class FlutterRouteWidget extends StatelessWidget {
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () {
Navigator.push(
context, MaterialPageRoute(builder: (_) => PushWidget()));
Navigator.push<dynamic>(
context, MaterialPageRoute<dynamic>(builder: (_) => PushWidget()));
},
),
InkWell(
......
......@@ -134,7 +134,7 @@ class _TestTextFieldState extends State<TestTextField> {
if (_node.hasFocus) {
print('showBottomSheet');
_controller = Scaffold.of(context)
.showBottomSheet((BuildContext ctx) => Container(
.showBottomSheet<dynamic>((BuildContext ctx) => Container(
width: double.infinity,
height: 36.0,
color: Colors.deepPurple,
......
......@@ -36,7 +36,7 @@ class BoostChannel {
final Set<MethodHandler> _methodHandlers = Set();
BoostChannel() {
_methodChannel.setMethodCallHandler((MethodCall call){
_methodChannel.setMethodCallHandler((MethodCall call) {
if (call.method == "__event__") {
String name = call.arguments["name"];
Map arg = call.arguments["arguments"];
......@@ -46,13 +46,13 @@ class BoostChannel {
l(name, arg);
}
}
}else{
for(MethodHandler handler in _methodHandlers) {
} else {
for (MethodHandler handler in _methodHandlers) {
handler(call);
}
}
return Future.value();
return Future<dynamic>.value();
});
}
......@@ -62,31 +62,33 @@ class BoostChannel {
}
if (arguments == null) {
arguments = Map();
arguments = Map<dynamic, dynamic>();
}
Map msg = Map();
Map msg = Map<dynamic, dynamic>();
msg["name"] = name;
msg["arguments"] = arguments;
_methodChannel.invokeMethod("__event__", msg);
_methodChannel.invokeMethod<dynamic>("__event__", msg);
}
Future<T> invokeMethod<T>(String method, [ dynamic arguments ]) async {
Future<T> invokeMethod<T>(String method, [dynamic arguments]) async {
assert(method != "__event__");
return _methodChannel.invokeMethod<T>(method,arguments);
return _methodChannel.invokeMethod<T>(method, arguments);
}
Future<List<T>> invokeListMethod<T>(String method, [ dynamic arguments ]) async {
Future<List<T>> invokeListMethod<T>(String method,
[dynamic arguments]) async {
assert(method != "__event__");
return _methodChannel.invokeListMethod<T>(method,arguments);
return _methodChannel.invokeListMethod<T>(method, arguments);
}
Future<Map<K, V>> invokeMapMethod<K, V>(String method, [ dynamic arguments ]) async {
Future<Map<K, V>> invokeMapMethod<K, V>(String method,
[dynamic arguments]) async {
assert(method != "__event__");
return _methodChannel.invokeMapMethod<K, V>(method,arguments);
return _methodChannel.invokeMapMethod<K, V>(method, arguments);
}
VoidCallback addEventListener(String name, EventListener listener) {
......@@ -110,7 +112,7 @@ class BoostChannel {
_methodHandlers.add(handler);
return (){
return () {
_methodHandlers.remove(handler);
};
}
......
......@@ -155,7 +155,6 @@ class BoostContainerState extends NavigatorState {
@override
void didUpdateWidget(Navigator oldWidget) {
super.didUpdateWidget(oldWidget);
}
@override
......@@ -189,6 +188,7 @@ class BoostContainerState extends NavigatorState {
break;
}
}
return false;
}
@override
......@@ -258,13 +258,10 @@ class ContainerElement extends StatefulElement {
}
class ContainerNavigatorObserver extends NavigatorObserver {
static final Set<NavigatorObserver> boostObservers =
Set<NavigatorObserver>();
static final Set<NavigatorObserver> boostObservers = Set<NavigatorObserver>();
ContainerNavigatorObserver();
factory ContainerNavigatorObserver.bindContainerManager() =>
ContainerNavigatorObserver();
......@@ -306,4 +303,3 @@ class ContainerNavigatorObserver extends NavigatorObserver {
}
}
}
......@@ -266,13 +266,11 @@ class ContainerCoordinator {
}
bool _nativeContainerWillDealloc(String name, Map params, String pageId) {
try{
try {
performContainerLifeCycle(_createContainerSettings(name, params, pageId),
ContainerLifeCycle.Destroy);
} catch (e){
Logger.log(
'nativeContainerWillDealloc error: ${e}' );
} catch (e) {
Logger.log('nativeContainerWillDealloc error: ${e}');
}
FlutterBoost.containerManager?.remove(pageId);
......
......@@ -76,7 +76,6 @@ class ContainerManagerState extends State<BoostContainerManager> {
bool get foreground => _foreground;
//Number of containers.
int get containerCounts => _offstage.length;
......@@ -138,7 +137,8 @@ class ContainerManagerState extends State<BoostContainerManager> {
properties['newName'] = now;
properties['oldName'] = old;
FlutterBoost.singleton.channel.invokeMethod('onShownContainerChanged',properties);
FlutterBoost.singleton.channel
.invokeMethod<dynamic>('onShownContainerChanged', properties);
}
void _refreshOverlayEntries() {
......@@ -345,4 +345,3 @@ class _ContainerOverlayEntry extends OverlayEntry {
super.remove();
}
}
......@@ -44,7 +44,6 @@ typedef void PostPushRoute(
String url, String uniqueId, Map params, Route route, Future result);
class FlutterBoost {
static final FlutterBoost _instance = FlutterBoost();
final GlobalKey<ContainerManagerState> containerManagerKey =
GlobalKey<ContainerManagerState>();
......@@ -60,19 +59,14 @@ class FlutterBoost {
{TransitionBuilder builder,
PrePushRoute prePush,
PostPushRoute postPush}) {
if(Platform.isAndroid){
WidgetsBinding.instance.addPostFrameCallback((_){
singleton.channel.invokeMethod<Map>('pageOnStart').then((Map pageInfo){
if (Platform.isAndroid) {
WidgetsBinding.instance.addPostFrameCallback((_) {
singleton.channel.invokeMethod<Map>('pageOnStart').then((Map pageInfo) {
if (pageInfo == null || pageInfo.isEmpty) return;
if (pageInfo.containsKey("name") &&
pageInfo.containsKey("params") &&
pageInfo.containsKey("uniqueId")) {
ContainerCoordinator.singleton.nativeContainerDidShow(
pageInfo["name"], pageInfo["params"], pageInfo["uniqueId"]);
}
......@@ -80,7 +74,6 @@ class FlutterBoost {
});
}
return (BuildContext context, Widget child) {
assert(child is Navigator, 'child must be Navigator, what is wrong?');
......@@ -102,7 +95,7 @@ class FlutterBoost {
BoostChannel get channel => _boostChannel;
FlutterBoost(){
FlutterBoost() {
ContainerCoordinator(_boostChannel);
}
......@@ -116,30 +109,29 @@ class FlutterBoost {
ContainerCoordinator.singleton.registerPageBuilders(builders);
}
Future<Map<dynamic,dynamic>> open(String url,{Map<dynamic,dynamic> urlParams,Map<dynamic,dynamic> exts}){
Future<Map<dynamic, dynamic>> open(String url,
{Map<dynamic, dynamic> urlParams, Map<dynamic, dynamic> exts}) {
Map<dynamic, dynamic> properties = new Map<dynamic, dynamic>();
properties["url"] = url;
properties["urlParams"] = urlParams;
properties["exts"] = exts;
return channel.invokeMethod<Map<dynamic,dynamic>>(
'openPage', properties);
return channel.invokeMethod<Map<dynamic, dynamic>>('openPage', properties);
}
Future<bool> close(String id,{Map<dynamic,dynamic> result,Map<dynamic,dynamic> exts}){
Future<bool> close(String id,
{Map<dynamic, dynamic> result, Map<dynamic, dynamic> exts}) {
assert(id != null);
BoostContainerSettings settings = containerManager?.onstageSettings;
Map<dynamic, dynamic> properties = new Map<dynamic, dynamic>();
if(exts == null){
exts = Map<dynamic,dynamic>();
if (exts == null) {
exts = Map<dynamic, dynamic>();
}
exts["params"] = settings.params;
if(!exts.containsKey("animated")){
if (!exts.containsKey("animated")) {
exts["animated"] = true;
}
......@@ -155,28 +147,30 @@ class FlutterBoost {
return channel.invokeMethod<bool>('closePage', properties);
}
Future<bool> closeCurrent({Map<String,dynamic> result,Map<String,dynamic> exts}) {
Future<bool> closeCurrent(
{Map<String, dynamic> result, Map<String, dynamic> exts}) {
BoostContainerSettings settings = containerManager?.onstageSettings;
if(exts == null){
exts = Map<String,dynamic>();
if (exts == null) {
exts = Map<String, dynamic>();
}
exts["params"] = settings.params;
if(!exts.containsKey("animated")){
if (!exts.containsKey("animated")) {
exts["animated"] = true;
}
return close(settings.uniqueId,result: result,exts: exts);
return close(settings.uniqueId, result: result, exts: exts);
}
Future<bool> closeByContext(BuildContext context,{Map<String,dynamic> result,Map<String,dynamic> exts}) {
Future<bool> closeByContext(BuildContext context,
{Map<String, dynamic> result, Map<String, dynamic> exts}) {
BoostContainerSettings settings = containerManager?.onstageSettings;
if(exts == null){
exts = Map<String,dynamic>();
if (exts == null) {
exts = Map<String, dynamic>();
}
exts["params"] = settings.params;
if(!exts.containsKey("animated")){
if (!exts.containsKey("animated")) {
exts["animated"] = true;
}
return close(settings.uniqueId,result: result,exts: exts);
return close(settings.uniqueId, result: result, exts: exts);
}
///register for Container changed callbacks
......@@ -191,6 +185,4 @@ class FlutterBoost {
///register callbacks for Navigators push & pop
void addBoostNavigatorObserver(NavigatorObserver observer) =>
ContainerNavigatorObserver.boostObservers.add(observer);
}
......@@ -23,7 +23,7 @@
*/
class Logger {
static void log(String msg) {
assert((){
assert(() {
print('FlutterBoost#$msg');
return true;
}());
......
......@@ -22,10 +22,10 @@ void main() {
response = null;
test('sendEvent successfully', () async {
Map msg1 = Map();
Map msg1 = Map<dynamic,dynamic>();
BoostChannel().sendEvent("name", msg1);
Map msg = Map();
Map msg = Map<dynamic,dynamic>();
msg["name"] = "name";
msg["arguments"] = msg1;
......@@ -38,9 +38,9 @@ void main() {
test('invokeMethod successfully', () async {
Map msg = {};
Map msg = <dynamic,dynamic>{};
msg["test"] = "test";
BoostChannel().invokeMethod("__event__1", msg);
BoostChannel().invokeMethod<dynamic>("__event__1", msg);
// expect(e, isException);
......@@ -52,9 +52,9 @@ void main() {
test('invokeListMethod successfully', () async {
Map msg = {};
Map msg = <dynamic,dynamic>{};
msg["test"] = "test";
var bb = await BoostChannel().invokeListMethod("__event__1", msg);
var bb = await BoostChannel().invokeListMethod<dynamic>("__event__1", msg);
expect(
log,
......@@ -64,9 +64,9 @@ void main() {
test('invokeMapMethod successfully', () async {
Map msg = {};
Map msg = <dynamic,dynamic>{};
msg["test"] = "test";
BoostChannel().invokeMapMethod("__event__1", msg);
BoostChannel().invokeMapMethod<dynamic,dynamic>("__event__1", msg);
expect(
log,
......@@ -75,9 +75,9 @@ void main() {
});
test('invokeMapMethod successfully', () async {
Map msg = {};
Map msg = <dynamic,dynamic>{};
msg["test"] = "test";
BoostChannel().invokeMapMethod("__event__1", msg);
BoostChannel().invokeMapMethod<dynamic,dynamic>("__event__1", msg);
expect(
log,
......
......@@ -49,8 +49,8 @@ void main() {
testWidgets(
'obtain BoostPageRoute through the `BoostPageRoute.of(context)` method',
(WidgetTester tester) async {
var boostPageRoute;
var boostPageRouteFindByOfMethod;
dynamic boostPageRoute;
dynamic boostPageRouteFindByOfMethod;
await tester.pumpWidget(
MaterialApp(
......@@ -61,7 +61,7 @@ void main() {
builder: (context) {
return FloatingActionButton(
onPressed: () {
boostPageRouteFindByOfMethod = BoostPageRoute.of(context);
boostPageRouteFindByOfMethod = BoostPageRoute.of<dynamic>(context);
},
);
},
......@@ -83,12 +83,12 @@ void main() {
'try to find BoostPageRoute through the `BoostPageRoute.of(context)` method, '
'but it doesn\'t exist, the method should throw an Exception',
(WidgetTester tester) async {
var contextCache;
dynamic contextCache;
await tester.pumpWidget(
MaterialApp(
onGenerateRoute: (RouteSettings settings) {
return MaterialPageRoute(
return MaterialPageRoute<dynamic>(
settings: settings,
builder: (context) => Builder(
builder: (context) => FloatingActionButton(
......@@ -103,14 +103,14 @@ void main() {
);
await tester.tap(find.byType(FloatingActionButton));
expect(() => BoostPageRoute.of(contextCache), throwsException);
expect(() => BoostPageRoute.of<dynamic>(contextCache), throwsException);
});
testWidgets(
'obtain BoostPageRoute through the `BoostPageRoute.tryOf(context)` method',
(WidgetTester tester) async {
var boostPageRoute;
var boostPageRouteFindByOfMethod;
dynamic boostPageRoute;
dynamic boostPageRouteFindByOfMethod;
await tester.pumpWidget(
MaterialApp(
......@@ -122,7 +122,7 @@ void main() {
return FloatingActionButton(
onPressed: () {
boostPageRouteFindByOfMethod =
BoostPageRoute.tryOf(context);
BoostPageRoute.tryOf<dynamic>(context);
},
);
},
......@@ -145,19 +145,19 @@ void main() {
'try to find BoostPageRoute through the `BoostPageRoute.tryOf(context)` method, '
'but it doesn\'t exist, the method should return null',
(WidgetTester tester) async {
var boostPageRouteFindByOfMethod;
dynamic boostPageRouteFindByOfMethod;
await tester.pumpWidget(
MaterialApp(
onGenerateRoute: (RouteSettings settings) {
return MaterialPageRoute(
return MaterialPageRoute<dynamic>(
settings: settings,
builder: (BuildContext context) => Builder(
builder: (context) {
return FloatingActionButton(
onPressed: () {
boostPageRouteFindByOfMethod =
BoostPageRoute.tryOf(context);
BoostPageRoute.tryOf<dynamic>(context);
},
);
},
......
......@@ -20,12 +20,12 @@ class MockBoostChannel extends BoostChannel implements Mock {
VoidCallback addEventListener(String name, EventListener listener) {
_testEventListener = listener;
super.addEventListener(name, listener);
return super.addEventListener(name, listener);
}
VoidCallback addMethodHandler(MethodHandler handler) {
_testHandler = handler;
super.addMethodHandler(handler);
return super.addMethodHandler(handler);
}
}
......@@ -39,9 +39,9 @@ void main() {
MockBoostChannel boostChannel = MockBoostChannel();
ContainerCoordinator(boostChannel);
final Map arguments = {};
final Map arguments =<dynamic,dynamic> {};
arguments["pageName"] = "pageName";
arguments["params"] = {};
arguments["params"] = <dynamic,dynamic>{};
arguments["uniqueId"] = "xxxxx";
MethodCall call = MethodCall('didInitPageContainer', arguments);
......@@ -97,7 +97,7 @@ void main() {
expect(e, isNoSuchMethodError);
}
Map arg = {'type': 'backPressedCallback'};
Map arg = <dynamic,dynamic>{'type': 'backPressedCallback'};
try {
boostChannel.testEventListener("lifecycle", arg);
} catch (e) {
......@@ -106,21 +106,21 @@ void main() {
Map arg2 = {'type': 'foreground'};
Map arg2 = <dynamic,dynamic>{'type': 'foreground'};
try {
boostChannel.testEventListener("lifecycle", arg2);
} catch (e) {
expect(e, isNoSuchMethodError);
}
Map arg3 = {'type': 'background'};
Map arg3 = <dynamic,dynamic>{'type': 'background'};
try {
boostChannel.testEventListener("lifecycle", arg3);
} catch (e) {
expect(e, isNoSuchMethodError);
}
Map arg4 = {'type': 'scheduleFrame'};
Map arg4 = <dynamic,dynamic>{'type': 'scheduleFrame'};
try {
boostChannel.testEventListener("lifecycle", arg4);
} catch (e) {
......
......@@ -34,13 +34,13 @@ void main() {
expect(e, isNoSuchMethodError);
}
try {
FlutterBoost.singleton.closeCurrent(result: {}, exts: {});
FlutterBoost.singleton.closeCurrent(result: <String,dynamic>{}, exts: <String,dynamic>{});
} catch (e) {
expect(e, isNoSuchMethodError);
}
try {
FlutterBoost.singleton.closeByContext(null, result: {}, exts: {});
FlutterBoost.singleton.closeByContext(null, result: <String,dynamic>{}, exts: <String,dynamic>{});
} catch (e) {
expect(e, isNoSuchMethodError);
}
......
......@@ -72,7 +72,7 @@ void main() {
);
//open firt page
ContainerCoordinator.singleton
.nativeContainerDidShow("first", {}, "1000000");
.nativeContainerDidShow("first", <dynamic,dynamic>{}, "1000000");
await tester.pump(const Duration(seconds: 1));
......@@ -80,7 +80,7 @@ void main() {
//open second page firt(1000000)->second(2000000)
ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000000");
.nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000000");
await tester.pump(const Duration(seconds: 1));
......@@ -97,7 +97,7 @@ void main() {
// second page ,but pageId is 2000001 firt(1000000)->second(2000001)
ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000001");
.nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000001");
await tester.pump(const Duration(seconds: 1));
......@@ -107,7 +107,7 @@ void main() {
//reopen firt page second(2000001)->firt(1000000)
ContainerCoordinator.singleton
.nativeContainerDidShow("first", {}, "1000000");
.nativeContainerDidShow("first",<dynamic,dynamic> {}, "1000000");
await tester.pump(const Duration(seconds: 1));
......@@ -117,7 +117,7 @@ void main() {
// reopen second page and pageId is 2000001 firt(1000000)->second(2000001)
ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000001");
.nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000001");
await tester.pump(const Duration(seconds: 1));
......@@ -135,7 +135,7 @@ void main() {
// open second(2000003)
ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000003");
.nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000003");
await tester.idle();
......
......@@ -30,7 +30,7 @@ class FirstRouteWidget extends StatelessWidget {
child: Text('Present second route'),
onPressed: () {
print("Present second page!");
FlutterBoost.singleton.open("second",urlParams:{"present":true}).then((Map value) {
FlutterBoost.singleton.open("second",urlParams:<dynamic,dynamic>{"present":true}).then((Map value) {
print(
"call me when page is finished. did recieve second route result $value");
});
......@@ -78,7 +78,7 @@ class SecondRouteWidget extends StatelessWidget {
BoostContainerSettings settings =
BoostContainer.of(context).settings;
FlutterBoost.singleton.close(settings.uniqueId,
result: {"result": "data from second"});
result:<dynamic,dynamic>{"result": "data from second"});
},
child: Text('Go back with result!'),
),
......@@ -172,7 +172,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("sample://nativePage", urlParams: {
.open("sample://nativePage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -189,7 +189,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("first", urlParams: {
.open("first", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -206,7 +206,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("second", urlParams: {
.open("second", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -223,7 +223,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("tab", urlParams: {
.open("tab", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"}
}),
),
......@@ -240,7 +240,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton
.open("sample://flutterPage", urlParams: {
.open("sample://flutterPage", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"}
}),
),
......@@ -254,8 +254,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (_) => PushWidget()));
Navigator.push<dynamic>(context,
MaterialPageRoute<dynamic>(builder: (_) => PushWidget()));
},
),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment