diff --git a/example/lib/hook_example.dart b/example/lib/hook_example.dart index 7fa25810e..321e3e987 100644 --- a/example/lib/hook_example.dart +++ b/example/lib/hook_example.dart @@ -333,7 +333,7 @@ class AddDemo { @Add("package:example/receiver_test.dart", "Receiver") @pragma("vm:entry-point") - dynamic addTest(PointCut pointCut, int j, {String s, int i}) { + dynamic addTest(PointCut pointCut, int j, {String? s, int? i}) { print('[beike_aspectd]: Add method'); } diff --git a/example/lib/main.dart b/example/lib/main.dart index 58e341b4e..cf2eb4bcb 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -69,7 +69,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + MyHomePage({Key? key, this.title}) : super(key: key); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect @@ -80,16 +80,16 @@ class MyHomePage extends StatefulWidget { // used by the build method of the State. Fields in a Widget subclass are // always marked "final". - final String title; + final String? title; @override _MyHomePageState createState() => _MyHomePageState(i: 19); } class TextRightImageModel { - String showName; + String? showName; - String rightIcon; + String? rightIcon; Widget showCardWidget(BuildContext context) { return Container( @@ -153,7 +153,7 @@ class _MyHomePageState extends State { appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. - title: Text(widget.title), + title: Text(widget.title??''), ), body: Center( // Center is a layout widget. It takes a single child and positions it diff --git a/example/lib/receiver_test.dart b/example/lib/receiver_test.dart index fc6fc405a..a8095e926 100644 --- a/example/lib/receiver_test.dart +++ b/example/lib/receiver_test.dart @@ -1,4 +1,3 @@ -// @dart=2.10 class Receiver { @@ -10,7 +9,7 @@ class Receiver { } - void receiveTapped(int i, {int j}) { + void receiveTapped(int i, {int? j}) { print('[KWLM]:onPluginDemo111 Called!'); } } diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 28a077e16..0a4de7c6e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -14,7 +14,7 @@ description: A new Flutter application. version: 1.0.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: diff --git a/inner/flutter_frontend_server/frontend_server.dart.snapshot b/inner/flutter_frontend_server/frontend_server.dart.snapshot index d91fe2f76..cd2983114 100644 Binary files a/inner/flutter_frontend_server/frontend_server.dart.snapshot and b/inner/flutter_frontend_server/frontend_server.dart.snapshot differ diff --git a/inner/snapshot.dart b/inner/snapshot.dart index 4e1837a96..f30b8008d 100644 --- a/inner/snapshot.dart +++ b/inner/snapshot.dart @@ -1,22 +1,41 @@ import 'dart:io'; void main(List args) async { - final String dartPath = Platform.executable; - List command = ['--snapshot=../lib/bin/starter.snapshot', 'tool/starter.dart']; + List command = [ + '--snapshot=../lib/bin/starter.snapshot', + 'tool/starter.dart' + ]; + + print('Start generating starter.snapshot...'); + Process result = await Process.start(dartPath, command); + + stdout.addStream(result.stdout); + stderr.addStream(result.stderr); + + if (await result.exitCode == 0) { + print('Generated starter.snapshot successfully!'); + } else { + print('Failed t0 generate starter.snapshot!'); + } + command = [ + '--deterministic', + '--snapshot=flutter_frontend_server/frontend_server.dart.snapshot', + 'flutter_frontend_server/starter.dart' + ]; - Process result = await Process.start( - dartPath, - command + print('Start generating frontend_server.dart.snapshot...'); - ); + result = await Process.start(dartPath, command); - command = ['--deterministic', '--snapshot=flutter_frontend_server/frontend_server.dart.snapshot', 'flutter_frontend_server/starter.dart']; + if (await result.exitCode == 0) { + print('Generated frontend_server.dart.snapshot successfully!'); + } else { + print('Failed t0 generate frontend_server.dart.snapshot!'); + } - result = await Process.start( - dartPath, - command - ); -} \ No newline at end of file + stdout.addStream(result.stdout); + stderr.addStream(result.stderr); +} diff --git a/lib/aspectd.dart b/lib/aspectd.dart index 430b4c6e9..56bf195d6 100644 --- a/lib/aspectd.dart +++ b/lib/aspectd.dart @@ -1,3 +1 @@ -// @dart=2.8 - export 'package:beike_aspectd/src/plugins/aop/aop.dart'; diff --git a/lib/bin/starter.snapshot b/lib/bin/starter.snapshot index 87905d516..d630e97d9 100644 Binary files a/lib/bin/starter.snapshot and b/lib/bin/starter.snapshot differ diff --git a/lib/src/plugins/aop/annotation/annotation_info.dart b/lib/src/plugins/aop/annotation/annotation_info.dart index 7f95b6cec..873ad98f9 100644 --- a/lib/src/plugins/aop/annotation/annotation_info.dart +++ b/lib/src/plugins/aop/annotation/annotation_info.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - /// Indicating which (library, cls, method) pair to operate on. @pragma('vm:entry-point') class AnnotationInfo { @@ -14,23 +12,23 @@ class AnnotationInfo { this.superCls,}); /// Indicating which dart file to operate on. - final String importUri; + final String? importUri; /// Indicating which dart class to operate on. - final String clsName; + final String? clsName; /// Indicating which dart method to operate on. - final String methodName; + final String? methodName; /// Indicating whether those specification above should be regarded as /// regex expressions. - final bool isRegex; + final bool? isRegex; /// Indicating which line to operate on. /// This is only meaningful for inject grammar. - final int lineNum; //Line Number to insert at(Before), 1 based. + final int? lineNum; //Line Number to insert at(Before), 1 based. /// Indicating which classes inherited from the superCls to operate on. /// This is only meaningful for regex add grammer. - final String superCls; + final String? superCls; } diff --git a/lib/src/plugins/aop/annotation/call.dart b/lib/src/plugins/aop/annotation/call.dart index 2ba514fb3..cdfebec87 100644 --- a/lib/src/plugins/aop/annotation/call.dart +++ b/lib/src/plugins/aop/annotation/call.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - import 'annotation_info.dart'; /// Call grammar is working on those callsites for the annotated method. @@ -11,7 +9,7 @@ class Call extends AnnotationInfo { @pragma('vm:entry-point') const Call._(String importUri, String clsName, String methodName, - {bool isRegex,this.excludeCoreLib}) + {bool? isRegex,this.excludeCoreLib}) : super( importUri: importUri, clsName: clsName, @@ -19,6 +17,6 @@ class Call extends AnnotationInfo { isRegex: isRegex); /// Indicate whether to exclude flutter libs - final bool excludeCoreLib; + final bool? excludeCoreLib; } diff --git a/lib/src/plugins/aop/annotation/execute.dart b/lib/src/plugins/aop/annotation/execute.dart index 785ef2a16..933985e12 100644 --- a/lib/src/plugins/aop/annotation/execute.dart +++ b/lib/src/plugins/aop/annotation/execute.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - import 'annotation_info.dart'; /// Execute grammar is working on method body. @@ -13,7 +11,7 @@ class Execute extends AnnotationInfo { @pragma('vm:entry-point') const Execute._(String importUri, String clsName, String methodName, - {bool isRegex}) + {bool? isRegex}) : super( importUri: importUri, clsName: clsName, diff --git a/lib/src/plugins/aop/annotation/inject.dart b/lib/src/plugins/aop/annotation/inject.dart index 749ab29c0..fa103bd71 100644 --- a/lib/src/plugins/aop/annotation/inject.dart +++ b/lib/src/plugins/aop/annotation/inject.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - import 'annotation_info.dart'; /// Inject grammar can help you to inject statements into specific method @@ -12,7 +10,7 @@ class Inject extends AnnotationInfo { @pragma('vm:entry-point') const Inject._(String importUri, String clsName, String methodName, - {int lineNum, bool isRegex}) + {int? lineNum, bool? isRegex}) : super( importUri: importUri, clsName: clsName, diff --git a/lib/src/plugins/aop/annotation/pointcut.dart b/lib/src/plugins/aop/annotation/pointcut.dart index 8a3a57fbd..de0c14203 100644 --- a/lib/src/plugins/aop/annotation/pointcut.dart +++ b/lib/src/plugins/aop/annotation/pointcut.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - /// Object carrying callsite information and methods which can enable you to /// call the original implementation. @pragma('vm:entry-point') @@ -14,35 +12,35 @@ class PointCut { } /// Source infomation like file, linenum, etc for a call. - final Map sourceInfos; + final Map? sourceInfos; /// Target where a call is operating on, like x for x.foo(). - final Object target; + final Object? target; /// Function name for a call, like foo for x.foo(). - final String function; + final String? function; /// Unique key which can help the proceed function to distinguish a /// mocked call. - final String stubKey; + final String? stubKey; /// Positional parameters for a call. - final List positionalParams; + final List? positionalParams; /// Named parameters for a call. - final Map namedParams; + final Map? namedParams; /// Class's members. In Call mode, it's caller class's members. In execute mode, it's execution class's members. - final Map members; + final Map? members; /// Class's annotations. In Call mode, it's caller class's annotations. In execute mode, it's execution class's annotations. - final Map annotations; + final Map? annotations; /// Unified entrypoint to call a original method, /// the method body is generated dynamically when being transformed in /// compile time. @pragma('vm:entry-point') - Object proceed() { + Object? proceed() { return null; } } diff --git a/lib/src/plugins/aop/aop.dart b/lib/src/plugins/aop/aop.dart index bf86649dd..7a450b24d 100644 --- a/lib/src/plugins/aop/aop.dart +++ b/lib/src/plugins/aop/aop.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - export 'annotation/aspect.dart'; export 'annotation/call.dart'; export 'annotation/execute.dart'; diff --git a/lib/src/plugins/aop/beike_annotation/add.dart b/lib/src/plugins/aop/beike_annotation/add.dart index 7c85a13f5..cc55080e9 100644 --- a/lib/src/plugins/aop/beike_annotation/add.dart +++ b/lib/src/plugins/aop/beike_annotation/add.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - import '../annotation/annotation_info.dart'; /// Call grammar is working on those callsites for the annotated method. @@ -11,7 +9,7 @@ class Add extends AnnotationInfo { @pragma('vm:entry-point') const Add._(String importUri, String clsName, - {bool isRegex, String superCls}) + {bool? isRegex, String? superCls}) : super( importUri: importUri, clsName: clsName, diff --git a/lib/src/plugins/aop/beike_annotation/field_get.dart b/lib/src/plugins/aop/beike_annotation/field_get.dart index b340e0377..c7024835a 100644 --- a/lib/src/plugins/aop/beike_annotation/field_get.dart +++ b/lib/src/plugins/aop/beike_annotation/field_get.dart @@ -1,5 +1,3 @@ -// @dart=2.8 - import '../annotation/annotation_info.dart'; /// Field get grammar is working on those callsites for the annotated method. @@ -11,7 +9,7 @@ class FieldGet extends AnnotationInfo { @pragma('vm:entry-point') const FieldGet._(String importUri, String clsName, this.fieldName, this.isStatic, - {bool isRegex}) + {bool? isRegex}) : super( importUri: importUri, clsName: clsName, diff --git a/pubspec.yaml b/pubspec.yaml index 66e33358b..d6940e801 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ homepage: https://github.com/LianjiaTech/Beike_AspectD.git # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: sdk: flutter