diff --git a/example/integration_test/app_test.dart b/example/integration_test/app_test.dart index 11ff48a..51d4f13 100644 --- a/example/integration_test/app_test.dart +++ b/example/integration_test/app_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; @@ -15,31 +14,31 @@ void main() { final list = find.byType(Scrollable).first; group('Encrypt and Decrypt OAEP', () { - final parent = find.byKey(ValueKey("encrypt-oaep")); + final parent = find.byKey(const ValueKey("encrypt-oaep")); testWidgets('Encrypt / Decrypt', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("encrypt")), + matching: find.byKey(const ValueKey("encrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); await expectLater(resultSelector, findsWidgets); var result = resultSelector.evaluate().single.widget as Text; @@ -47,700 +46,700 @@ void main() { container = find.descendant( of: parent, - matching: find.byKey(ValueKey("decrypt")), + matching: find.byKey(const ValueKey("decrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); await expectLater(resultSelector, findsWidgets); result = resultSelector.evaluate().single.widget as Text; expect(result.data, equals(input)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Encrypt and Decrypt OAEP Bytes', () { - final parent = find.byKey(ValueKey("encrypt-oaep-bytes")); + final parent = find.byKey(const ValueKey("encrypt-oaep-bytes")); testWidgets('Encrypt / Decrypt', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("encrypt")), + matching: find.byKey(const ValueKey("encrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); container = find.descendant( of: parent, - matching: find.byKey(ValueKey("decrypt")), + matching: find.byKey(const ValueKey("decrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Encrypt and Decrypt PKCS1v15', () { - final parent = find.byKey(ValueKey("encrypt-pkcs")); + final parent = find.byKey(const ValueKey("encrypt-pkcs")); testWidgets('Encrypt / Decrypt', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("encrypt")), + matching: find.byKey(const ValueKey("encrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); container = find.descendant( of: parent, - matching: find.byKey(ValueKey("decrypt")), + matching: find.byKey(const ValueKey("decrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); result = resultSelector.evaluate().single.widget as Text; expect(result.data, equals(input)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Encrypt and Decrypt PKCS1v15 Bytes', () { - final parent = find.byKey(ValueKey("encrypt-pkcs-bytes")); + final parent = find.byKey(const ValueKey("encrypt-pkcs-bytes")); testWidgets('Encrypt / Decrypt', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("encrypt")), + matching: find.byKey(const ValueKey("encrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); container = find.descendant( of: parent, - matching: find.byKey(ValueKey("decrypt")), + matching: find.byKey(const ValueKey("decrypt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); result = resultSelector.evaluate().single.widget as Text; expect(result.data, equals(input)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Sign And Verify PSS', () { - final parent = find.byKey(ValueKey("sign-pss")); + final parent = find.byKey(const ValueKey("sign-pss")); testWidgets('Sign / Verify', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("sign")), + matching: find.byKey(const ValueKey("sign")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); container = find.descendant( of: parent, - matching: find.byKey(ValueKey("verify")), + matching: find.byKey(const ValueKey("verify")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); result = resultSelector.evaluate().single.widget as Text; expect(result.data, "VALID"); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Sign And Verify PSS Bytes', () { - final parent = find.byKey(ValueKey("sign-pss-bytes")); + final parent = find.byKey(const ValueKey("sign-pss-bytes")); testWidgets('Sign / Verify', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("sign")), + matching: find.byKey(const ValueKey("sign")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); container = find.descendant( of: parent, - matching: find.byKey(ValueKey("verify")), + matching: find.byKey(const ValueKey("verify")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); result = resultSelector.evaluate().single.widget as Text; expect(result.data, "VALID"); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Sign And Verify PKCS', () { - final parent = find.byKey(ValueKey("sign-pkcs")); + final parent = find.byKey(const ValueKey("sign-pkcs")); testWidgets('Sign / Verify', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("sign")), + matching: find.byKey(const ValueKey("sign")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); container = find.descendant( of: parent, - matching: find.byKey(ValueKey("verify")), + matching: find.byKey(const ValueKey("verify")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); result = resultSelector.evaluate().single.widget as Text; expect(result.data, "VALID"); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Sign And Verify PKCS Bytes', () { - final parent = find.byKey(ValueKey("sign-pkcs-bytes")); + final parent = find.byKey(const ValueKey("sign-pkcs-bytes")); testWidgets('Sign / Verify', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); var container = find.descendant( of: parent, - matching: find.byKey(ValueKey("sign")), + matching: find.byKey(const ValueKey("sign")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); container = find.descendant( of: parent, - matching: find.byKey(ValueKey("verify")), + matching: find.byKey(const ValueKey("verify")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); result = resultSelector.evaluate().single.widget as Text; expect(result.data, "VALID"); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Base64', () { - final parent = find.byKey(ValueKey("base64")); + final parent = find.byKey(const ValueKey("base64")); testWidgets('Default', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("encode")), + matching: find.byKey(const ValueKey("encode")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Hash', () { - final parent = find.byKey(ValueKey("hash")); + final parent = find.byKey(const ValueKey("hash")); testWidgets('Default', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("encode")), + matching: find.byKey(const ValueKey("encode")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.enterText( find.descendant( - of: container, matching: find.byKey(ValueKey("message"))), + of: container, matching: find.byKey(const ValueKey("message"))), input); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Generate', () { - final parent = find.byKey(ValueKey("generate")); + final parent = find.byKey(const ValueKey("generate")); testWidgets('Default', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("action")), + matching: find.byKey(const ValueKey("action")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); - await tester.pumpAndSettle(Duration(seconds: 5)); + await tester.pumpAndSettle(const Duration(seconds: 5)); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(minutes: 5))); + }, timeout: const Timeout(Duration(minutes: 5))); }); group('Convert PrivateKey', () { - final parent = find.byKey(ValueKey("convert-private")); + final parent = find.byKey(const ValueKey("convert-private")); testWidgets('JWT', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("jwt")), + matching: find.byKey(const ValueKey("jwt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); testWidgets('PKCS1', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("pkcs1")), + matching: find.byKey(const ValueKey("pkcs1")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); testWidgets('PKCS8', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("pkcs8")), + matching: find.byKey(const ValueKey("pkcs8")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Convert PublicKey', () { - final parent = find.byKey(ValueKey("convert-public")); + final parent = find.byKey(const ValueKey("convert-public")); testWidgets('JWT', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("jwt")), + matching: find.byKey(const ValueKey("jwt")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); testWidgets('PKCS1', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("pkcs1")), + matching: find.byKey(const ValueKey("pkcs1")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); testWidgets('PKIX', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("pkix")), + matching: find.byKey(const ValueKey("pkix")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Convert JWT', () { - final parent = find.byKey(ValueKey("convert-jwt")); + final parent = find.byKey(const ValueKey("convert-jwt")); testWidgets('PrivateKey', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("private")), + matching: find.byKey(const ValueKey("private")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); testWidgets('PublicKey', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("public")), + matching: find.byKey(const ValueKey("public")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); group('Convert KeyPair', () { - final parent = find.byKey(ValueKey("convert-keypair")); + final parent = find.byKey(const ValueKey("convert-keypair")); testWidgets('PKCS12', (WidgetTester tester) async { - final instance = app.MyApp(); + const instance = app.MyApp(); await tester.pumpWidget(instance); await tester.pumpAndSettle(); final container = find.descendant( of: parent, - matching: find.byKey(ValueKey("pkcs12")), + matching: find.byKey(const ValueKey("pkcs12")), ); await tester.scrollUntilVisible(container, dyScroll, scrollable: list); await tester.pumpAndSettle(); await tester.tap( find.descendant( - of: container, matching: find.byKey(ValueKey("button"))), + of: container, matching: find.byKey(const ValueKey("button"))), ); await tester.pumpAndSettle(); var resultSelector = find.descendant( - of: container, matching: find.byKey(ValueKey("result"))); + of: container, matching: find.byKey(const ValueKey("result"))); expect(resultSelector, findsOneWidget); var result = resultSelector.evaluate().single.widget as Text; expect(result.data != "", equals(true)); - }, timeout: Timeout(Duration(seconds: 60))); + }, timeout: const Timeout(Duration(seconds: 60))); }); }); } diff --git a/example/lib/base64.dart b/example/lib/base64.dart index b2b5c08..3847eed 100644 --- a/example/lib/base64.dart +++ b/example/lib/base64.dart @@ -1,22 +1,15 @@ -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; -import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class Base64 extends StatefulWidget { const Base64({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -38,7 +31,7 @@ class _Base64State extends State { TitleWidget(widget.title), InputWidget( title: "Encode", - key: Key("encode"), + key: const Key("encode"), result: _encrypted, onPressed: (controller) async { var encrypted = await RSA.base64( diff --git a/example/lib/convert_jwt.dart b/example/lib/convert_jwt.dart index a25d087..73c601e 100644 --- a/example/lib/convert_jwt.dart +++ b/example/lib/convert_jwt.dart @@ -1,23 +1,15 @@ -import 'dart:convert'; -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; -import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class ConvertJWT extends StatefulWidget { const ConvertJWT({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -45,7 +37,7 @@ class _ConvertJWTState extends State { TitleWidget(widget.title), ButtonWidget( title: "To PrivateKey", - key: Key("private"), + key: const Key("private"), result: _private, onPressed: () async { var converted = await RSA.convertPrivateKeyToJWK( @@ -59,7 +51,7 @@ class _ConvertJWTState extends State { ), ButtonWidget( title: "To PublicKey", - key: Key("public"), + key: const Key("public"), result: _public, onPressed: () async { var converted = await RSA.convertPublicKeyToJWK( diff --git a/example/lib/convert_keypair.dart b/example/lib/convert_keypair.dart index c7940a3..cd47b82 100644 --- a/example/lib/convert_keypair.dart +++ b/example/lib/convert_keypair.dart @@ -1,23 +1,16 @@ -import 'dart:convert'; -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; -import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class ConvertKeyPair extends StatefulWidget { const ConvertKeyPair({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -44,7 +37,7 @@ class _ConvertKeyPairState extends State { TitleWidget(widget.title), ButtonWidget( title: "To PKCS12", - key: Key("pkcs12"), + key: const Key("pkcs12"), result: _pkcs12, onPressed: () async { var result = await RSA.convertKeyPairToPKCS12( diff --git a/example/lib/convert_private.dart b/example/lib/convert_private.dart index ca5631a..a1f3e81 100644 --- a/example/lib/convert_private.dart +++ b/example/lib/convert_private.dart @@ -1,23 +1,17 @@ import 'dart:convert'; -import 'dart:typed_data'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; -import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class ConvertPrivate extends StatefulWidget { const ConvertPrivate({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -42,7 +36,7 @@ class _ConvertPrivateState extends State { TitleWidget(widget.title), ButtonWidget( title: "To JWT", - key: Key("jwt"), + key: const Key("jwt"), result: _jwt, onPressed: () async { var result = await RSA.convertPrivateKeyToJWK( @@ -55,7 +49,7 @@ class _ConvertPrivateState extends State { ), ButtonWidget( title: "To PKCS1", - key: Key("pkcs1"), + key: const Key("pkcs1"), result: _pkcs1, onPressed: () async { var result = await RSA.convertPrivateKeyToPKCS1( @@ -68,7 +62,7 @@ class _ConvertPrivateState extends State { ), ButtonWidget( title: "To PKCS8", - key: Key("pkcs8"), + key: const Key("pkcs8"), result: _pkcs8, onPressed: () async { var result = await RSA.convertPrivateKeyToPKCS8( @@ -81,7 +75,7 @@ class _ConvertPrivateState extends State { ), ButtonWidget( title: "To PublicKey", - key: Key("public-key"), + key: const Key("public-key"), result: _publicKey, onPressed: () async { var result = await RSA.convertPrivateKeyToPublicKey( diff --git a/example/lib/convert_public.dart b/example/lib/convert_public.dart index 0b1be86..c47450b 100644 --- a/example/lib/convert_public.dart +++ b/example/lib/convert_public.dart @@ -1,23 +1,17 @@ import 'dart:convert'; -import 'dart:typed_data'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; -import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class ConvertPublic extends StatefulWidget { const ConvertPublic({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -41,7 +35,7 @@ class _ConvertPublicState extends State { TitleWidget(widget.title), ButtonWidget( title: "To JWT", - key: Key("jwt"), + key: const Key("jwt"), result: _jwt, onPressed: () async { var result = await RSA.convertPublicKeyToJWK( @@ -54,7 +48,7 @@ class _ConvertPublicState extends State { ), ButtonWidget( title: "To PKCS1", - key: Key("pkcs1"), + key: const Key("pkcs1"), result: _pkcs1, onPressed: () async { var result = await RSA.convertPublicKeyToPKCS1( @@ -67,7 +61,7 @@ class _ConvertPublicState extends State { ), ButtonWidget( title: "To PKIX", - key: Key("pkix"), + key: const Key("pkix"), result: _pkix, onPressed: () async { var result = await RSA.convertPublicKeyToPKIX( diff --git a/example/lib/encrypt_decrypt_oaep.dart b/example/lib/encrypt_decrypt_oaep.dart index b090655..3d9d930 100644 --- a/example/lib/encrypt_decrypt_oaep.dart +++ b/example/lib/encrypt_decrypt_oaep.dart @@ -1,22 +1,16 @@ -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class EncryptAndDecryptOAEP extends StatefulWidget { const EncryptAndDecryptOAEP({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -39,7 +33,7 @@ class _EncryptAndDecryptOAEPState extends State { TitleWidget(widget.title), InputWidget( title: "Encrypt", - key: Key("encrypt"), + key: const Key("encrypt"), result: _encrypted, onPressed: (controller) async { var encrypted = await RSA.encryptOAEP( @@ -55,7 +49,7 @@ class _EncryptAndDecryptOAEPState extends State { ), ButtonWidget( title: "Decrypt", - key: Key("decrypt"), + key: const Key("decrypt"), result: _decrypted, onPressed: () async { var decrypted = await RSA.decryptOAEP( diff --git a/example/lib/encrypt_decrypt_oaep_bytes.dart b/example/lib/encrypt_decrypt_oaep_bytes.dart index b3f98e2..d838070 100644 --- a/example/lib/encrypt_decrypt_oaep_bytes.dart +++ b/example/lib/encrypt_decrypt_oaep_bytes.dart @@ -1,23 +1,19 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class EncryptAndDecryptOAEPBytes extends StatefulWidget { const EncryptAndDecryptOAEPBytes({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -42,7 +38,7 @@ class _EncryptAndDecryptOAEPBytesState TitleWidget(widget.title), InputWidget( title: "Encrypt", - key: Key("encrypt"), + key: const Key("encrypt"), result: _encrypted, onPressed: (controller) async { var encrypted = await RSA.encryptOAEPBytes( @@ -58,7 +54,7 @@ class _EncryptAndDecryptOAEPBytesState ), ButtonWidget( title: "Decrypt", - key: Key("decrypt"), + key: const Key("decrypt"), result: _decrypted, onPressed: () async { var decrypted = await RSA.decryptOAEPBytes( diff --git a/example/lib/encrypt_decrypt_pkcs.dart b/example/lib/encrypt_decrypt_pkcs.dart index 005e390..c4580a5 100644 --- a/example/lib/encrypt_decrypt_pkcs.dart +++ b/example/lib/encrypt_decrypt_pkcs.dart @@ -1,22 +1,16 @@ -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class EncryptAndDecryptPKCS extends StatefulWidget { const EncryptAndDecryptPKCS({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -39,7 +33,7 @@ class _EncryptAndDecryptPKCSState extends State { TitleWidget(widget.title), InputWidget( title: "Encrypt", - key: Key("encrypt"), + key: const Key("encrypt"), result: _encrypted, onPressed: (controller) async { var encrypted = await RSA.encryptPKCS1v15( @@ -53,7 +47,7 @@ class _EncryptAndDecryptPKCSState extends State { ), ButtonWidget( title: "Decrypt", - key: Key("decrypt"), + key: const Key("decrypt"), result: _decrypted, onPressed: () async { var decrypted = await RSA.decryptPKCS1v15( diff --git a/example/lib/encrypt_decrypt_pkcs_bytes.dart b/example/lib/encrypt_decrypt_pkcs_bytes.dart index f83f3b0..b0344e6 100644 --- a/example/lib/encrypt_decrypt_pkcs_bytes.dart +++ b/example/lib/encrypt_decrypt_pkcs_bytes.dart @@ -1,23 +1,19 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class EncryptAndDecryptPKCSBytes extends StatefulWidget { const EncryptAndDecryptPKCSBytes({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -42,7 +38,7 @@ class _EncryptAndDecryptPKCSBytesState TitleWidget(widget.title), InputWidget( title: "Encrypt", - key: Key("encrypt"), + key: const Key("encrypt"), result: _encrypted, onPressed: (controller) async { var encrypted = await RSA.encryptPKCS1v15Bytes( @@ -56,7 +52,7 @@ class _EncryptAndDecryptPKCSBytesState ), ButtonWidget( title: "Decrypt", - key: Key("decrypt"), + key: const Key("decrypt"), result: _decrypted, onPressed: () async { var decrypted = await RSA.decryptPKCS1v15Bytes( diff --git a/example/lib/encrypt_sign_pkcs.dart b/example/lib/encrypt_sign_pkcs.dart index 902179d..fbd5e63 100644 --- a/example/lib/encrypt_sign_pkcs.dart +++ b/example/lib/encrypt_sign_pkcs.dart @@ -1,22 +1,16 @@ -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class SignAndVerifyPKCS extends StatefulWidget { const SignAndVerifyPKCS({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -40,7 +34,7 @@ class _SignAndVerifyPKCSState extends State { TitleWidget(widget.title), InputWidget( title: "Sign", - key: Key("sign"), + key: const Key("sign"), result: _signed, onPressed: (controller) async { var result = await RSA.signPKCS1v15( @@ -56,7 +50,7 @@ class _SignAndVerifyPKCSState extends State { ), ButtonWidget( title: "Verify", - key: Key("verify"), + key: const Key("verify"), result: _valid, onPressed: () async { var result = await RSA.verifyPKCS1v15( diff --git a/example/lib/encrypt_sign_pkcs_bytes.dart b/example/lib/encrypt_sign_pkcs_bytes.dart index 31a94aa..5d4bf40 100644 --- a/example/lib/encrypt_sign_pkcs_bytes.dart +++ b/example/lib/encrypt_sign_pkcs_bytes.dart @@ -1,23 +1,19 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class SignAndVerifyPKCSBytes extends StatefulWidget { const SignAndVerifyPKCSBytes({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -41,7 +37,7 @@ class _SignAndVerifyPKCSBytesState extends State { TitleWidget(widget.title), InputWidget( title: "Sign", - key: Key("sign"), + key: const Key("sign"), result: _signed, onPressed: (controller) async { var result = await RSA.signPKCS1v15Bytes( @@ -57,7 +53,7 @@ class _SignAndVerifyPKCSBytesState extends State { ), ButtonWidget( title: "Verify", - key: Key("verify"), + key: const Key("verify"), result: _valid, onPressed: () async { var result = await RSA.verifyPKCS1v15Bytes( diff --git a/example/lib/encrypt_sign_pss.dart b/example/lib/encrypt_sign_pss.dart index 811c93f..abd0b46 100644 --- a/example/lib/encrypt_sign_pss.dart +++ b/example/lib/encrypt_sign_pss.dart @@ -1,22 +1,16 @@ -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class SignAndVerifyPSS extends StatefulWidget { const SignAndVerifyPSS({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -40,7 +34,7 @@ class _SignAndVerifyPSSState extends State { TitleWidget(widget.title), InputWidget( title: "Sign", - key: Key("sign"), + key: const Key("sign"), result: _signed, onPressed: (controller) async { var result = await RSA.signPSS( @@ -57,7 +51,7 @@ class _SignAndVerifyPSSState extends State { ), ButtonWidget( title: "Verify", - key: Key("verify"), + key: const Key("verify"), result: _valid, onPressed: () async { var result = await RSA.verifyPSS( diff --git a/example/lib/encrypt_sign_pss_bytes.dart b/example/lib/encrypt_sign_pss_bytes.dart index 283e6b2..97833b3 100644 --- a/example/lib/encrypt_sign_pss_bytes.dart +++ b/example/lib/encrypt_sign_pss_bytes.dart @@ -1,23 +1,19 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class SignAndVerifyPSSBytes extends StatefulWidget { const SignAndVerifyPSSBytes({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -41,7 +37,7 @@ class _SignAndVerifyPSSBytesState extends State { TitleWidget(widget.title), InputWidget( title: "Sign", - key: Key("sign"), + key: const Key("sign"), result: _signed, onPressed: (controller) async { var result = await RSA.signPSSBytes( @@ -58,7 +54,7 @@ class _SignAndVerifyPSSBytesState extends State { ), ButtonWidget( title: "Verify", - key: Key("verify"), + key: const Key("verify"), result: _valid, onPressed: () async { var result = await RSA.verifyPSSBytes( diff --git a/example/lib/generate.dart b/example/lib/generate.dart index cbaba5d..ab6051e 100644 --- a/example/lib/generate.dart +++ b/example/lib/generate.dart @@ -1,21 +1,15 @@ -import 'dart:convert'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; import 'package:fast_rsa_example/shared/button_widget.dart'; -import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class Generate extends StatefulWidget { const Generate({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -37,7 +31,7 @@ class _GenerateState extends State { TitleWidget(widget.title), ButtonWidget( title: "Generate", - key: Key("action"), + key: const Key("action"), result: _keyPair.privateKey + _keyPair.publicKey, onPressed: () async { var keyPair = await RSA.generate(2048); diff --git a/example/lib/hash.dart b/example/lib/hash.dart index 02da598..884c5af 100644 --- a/example/lib/hash.dart +++ b/example/lib/hash.dart @@ -1,21 +1,14 @@ -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fast_rsa/fast_rsa.dart'; -import 'package:fast_rsa_example/main.dart'; -import 'package:fast_rsa_example/shared/button_widget.dart'; import 'package:fast_rsa_example/shared/input_widget.dart'; import 'package:fast_rsa_example/shared/title_widget.dart'; class HashExample extends StatefulWidget { const HashExample({ - Key? key, + super.key, required this.title, required PKCS12KeyPair keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final PKCS12KeyPair keyPair; final String title; @@ -37,7 +30,7 @@ class _HashExampleState extends State { TitleWidget(widget.title), InputWidget( title: "Encode", - key: Key("encode"), + key: const Key("encode"), result: _encrypted, onPressed: (controller) async { var encrypted = await RSA.hash(controller.text, Hash.SHA512); diff --git a/example/lib/main.dart b/example/lib/main.dart index 67be7ab..959bfed 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,6 +1,4 @@ -import 'dart:convert'; import 'dart:io'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -116,10 +114,12 @@ void main() { debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; } - runApp(new MyApp()); + runApp(const MyApp()); } class MyApp extends StatefulWidget { + const MyApp({super.key}); + @override _MyAppState createState() => _MyAppState(); } @@ -157,82 +157,82 @@ class _MyAppState extends State { title: const Text('RSA example app'), ), body: ListView( - key: Key("list"), + key: const Key("list"), children: [ EncryptAndDecryptOAEP( title: "Encrypt and Decrypt OAEP", keyPair: _pkcs12KeyPair, - key: Key("encrypt-oaep"), + key: const Key("encrypt-oaep"), ), EncryptAndDecryptOAEPBytes( title: "Encrypt and Decrypt OAEP Bytes", keyPair: _pkcs12KeyPair, - key: Key("encrypt-oaep-bytes"), + key: const Key("encrypt-oaep-bytes"), ), EncryptAndDecryptPKCS( title: "Encrypt and Decrypt PKCS1v15", keyPair: _pkcs12KeyPair, - key: Key("encrypt-pkcs"), + key: const Key("encrypt-pkcs"), ), EncryptAndDecryptPKCSBytes( title: "Encrypt and Decrypt PKCS1v15 Bytes", keyPair: _pkcs12KeyPair, - key: Key("encrypt-pkcs-bytes"), + key: const Key("encrypt-pkcs-bytes"), ), SignAndVerifyPSS( title: "Sign and Verify PSS", keyPair: _pkcs12KeyPair, - key: Key("sign-pss"), + key: const Key("sign-pss"), ), SignAndVerifyPSSBytes( title: "Sign and Verify PSS Bytes", keyPair: _pkcs12KeyPair, - key: Key("sign-pss-bytes"), + key: const Key("sign-pss-bytes"), ), SignAndVerifyPKCS( title: "Sign and Verify PKCS", keyPair: _pkcs12KeyPair, - key: Key("sign-pkcs"), + key: const Key("sign-pkcs"), ), SignAndVerifyPKCSBytes( title: "Sign and Verify PKCS Bytes", keyPair: _pkcs12KeyPair, - key: Key("sign-pkcs-bytes"), + key: const Key("sign-pkcs-bytes"), ), Base64( title: "Base64", keyPair: _pkcs12KeyPair, - key: Key("base64"), + key: const Key("base64"), ), HashExample( title: "Hash", keyPair: _pkcs12KeyPair, - key: Key("hash"), + key: const Key("hash"), ), Generate( title: "Generate", keyPair: _pkcs12KeyPair, - key: Key("generate"), + key: const Key("generate"), ), ConvertPrivate( title: "Convert PrivateKey", keyPair: _pkcs12KeyPair, - key: Key("convert-private"), + key: const Key("convert-private"), ), ConvertPublic( title: "Convert PublicKey", keyPair: _pkcs12KeyPair, - key: Key("convert-public"), + key: const Key("convert-public"), ), ConvertJWT( title: "Convert JWT", keyPair: _pkcs12KeyPair, - key: Key("convert-jwt"), + key: const Key("convert-jwt"), ), ConvertKeyPair( title: "Convert KeyPair", keyPair: _pkcs12KeyPair, - key: Key("convert-keypair"), + key: const Key("convert-keypair"), ), ], ), diff --git a/example/lib/shared/button_widget.dart b/example/lib/shared/button_widget.dart index 5104479..b903afe 100644 --- a/example/lib/shared/button_widget.dart +++ b/example/lib/shared/button_widget.dart @@ -1,15 +1,13 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ButtonWidget extends StatefulWidget { const ButtonWidget({ - Key? key, + super.key, required this.result, required String title, required Function onPressed, }) : onPressed = onPressed, - title = title, - super(key: key); + title = title; final Function onPressed; final String title; @@ -29,23 +27,23 @@ class _ButtonWidgetState extends State { child: Column( children: [ ElevatedButton( - child: Text(widget.title), onPressed: () async { await widget.onPressed(); setState(() { _loading = false; }); }, - key: Key("button"), + key: const Key("button"), + child: Text(widget.title), ), (_loading) ? Text( widget.result, - key: Key("loading"), + key: const Key("loading"), ) : Text( widget.result, - key: Key("result"), + key: const Key("result"), ) ], ), diff --git a/example/lib/shared/input_widget.dart b/example/lib/shared/input_widget.dart index e7aa4b5..85d1ecb 100644 --- a/example/lib/shared/input_widget.dart +++ b/example/lib/shared/input_widget.dart @@ -1,15 +1,13 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class InputWidget extends StatefulWidget { const InputWidget({ - Key? key, + super.key, required this.result, required String title, required Function(TextEditingController) onPressed, }) : onPressed = onPressed, - title = title, - super(key: key); + title = title; final Function(TextEditingController) onPressed; final String title; @@ -47,12 +45,11 @@ class _InputWidgetState extends State { TextField( autofocus: false, focusNode: _focusNode, - decoration: InputDecoration(labelText: "Message"), + decoration: const InputDecoration(labelText: "Message"), controller: _controller, - key: Key("message"), + key: const Key("message"), ), ElevatedButton( - child: Text(widget.title), onPressed: () async { _focusNode!.unfocus(); await widget.onPressed(_controller); @@ -60,16 +57,17 @@ class _InputWidgetState extends State { _loading = false; }); }, - key: Key("button"), + key: const Key("button"), + child: Text(widget.title), ), (_loading) ? Text( widget.result, - key: Key("loading"), + key: const Key("loading"), ) : Text( widget.result, - key: Key("result"), + key: const Key("result"), ) ], ), diff --git a/example/lib/shared/title_widget.dart b/example/lib/shared/title_widget.dart index b9bd8da..cb38f95 100644 --- a/example/lib/shared/title_widget.dart +++ b/example/lib/shared/title_widget.dart @@ -3,8 +3,8 @@ import 'package:flutter/cupertino.dart'; class TitleWidget extends StatelessWidget { const TitleWidget( this.title, { - Key? key, - }) : super(key: key); + super.key, + }); final String title; @@ -14,7 +14,7 @@ class TitleWidget extends StatelessWidget { padding: const EdgeInsets.only(top: 10), child: Text( title, - style: TextStyle( + style: const TextStyle( fontSize: 20, ), ),