diff --git a/lib/core/processors/image_extractor.dart b/lib/core/processors/image_extractor.dart index 8b3596af..5ac95bfe 100644 --- a/lib/core/processors/image_extractor.dart +++ b/lib/core/processors/image_extractor.dart @@ -1,13 +1,10 @@ -// @dart=2.9 - import 'package:equatable/equatable.dart'; -import 'package:meta/meta.dart'; class NoteImage extends Equatable { final String url; final String alt; - NoteImage({@required this.url, @required this.alt}); + NoteImage({required this.url, required this.alt}); @override List<Object> get props => [url, alt]; @@ -26,7 +23,7 @@ class ImageExtractor { var alt = match.group(1); var url = match.group(2); - images.add(NoteImage(alt: alt, url: url)); + images.add(NoteImage(alt: alt ?? "", url: url ?? "")); } return images; diff --git a/lib/core/processors/inline_tags.dart b/lib/core/processors/inline_tags.dart index b417c232..127a413c 100644 --- a/lib/core/processors/inline_tags.dart +++ b/lib/core/processors/inline_tags.dart @@ -1,5 +1,3 @@ -// @dart=2.9 - /* (c) Copyright 2020 Vishesh Handa @@ -26,12 +24,10 @@ THE SOFTWARE. */ -import 'package:meta/meta.dart'; - class InlineTagsProcessor { final Set<String> tagPrefixes; - InlineTagsProcessor({@required this.tagPrefixes}); + InlineTagsProcessor({required this.tagPrefixes}); Set<String> extractTags(String text) { var tags = <String>{}; @@ -46,7 +42,7 @@ class InlineTagsProcessor { var regexp = RegExp(r'(^|\s)' + p + r'([^\s]+)(\s|$)'); var matches = regexp.allMatches(text); for (var match in matches) { - var tag = match.group(2); + var tag = match.group(2)!; if (tag.endsWith('.') || tag.endsWith('!') || tag.endsWith('?')) { tag = tag.substring(0, tag.length - 1); diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index a75f94f2..1df1cb71 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -1,5 +1,3 @@ -// @dart=2.9 - /* Code adapted from https://github.com/TheAlphamerc/flutter_login_signup/ @@ -43,9 +41,9 @@ import 'package:gitjournal/widgets/scroll_view_without_animation.dart'; // const _prodServer = 'https://api.gitjournal.io/auth/'; class LoginPage extends StatefulWidget { - LoginPage({Key key, this.title}) : super(key: key); + LoginPage({Key? key, this.title}) : super(key: key); - final String title; + final String? title; @override _LoginPageState createState() => _LoginPageState(); @@ -90,9 +88,7 @@ class _LoginPageState extends State<LoginPage> { ); return InkWell( - onTap: () { - _loginAction(); - }, + onTap: _loginAction, child: c, ); } @@ -318,7 +314,7 @@ class FormTitle extends StatelessWidget { @override Widget build(BuildContext context) { var textTheme = Theme.of(context).textTheme; - var style = textTheme.headline2.copyWith(fontFamily: "Lato"); + var style = textTheme.headline2!.copyWith(fontFamily: "Lato"); return Text('GitJournal', style: style); } } diff --git a/lib/screens/settings_experimental.dart b/lib/screens/settings_experimental.dart index abe9a51a..3a95c2bb 100644 --- a/lib/screens/settings_experimental.dart +++ b/lib/screens/settings_experimental.dart @@ -1,5 +1,3 @@ -// @dart=2.9 - /* Copyright 2020-2021 Vishesh Handa <me@vhanda.in> diff --git a/lib/ssh/keygen.dart b/lib/ssh/keygen.dart index b694ba3f..baee33e7 100644 --- a/lib/ssh/keygen.dart +++ b/lib/ssh/keygen.dart @@ -1,9 +1,6 @@ -// @dart=2.9 - import 'dart:io'; import 'package:git_bindings/git_bindings.dart' as gb; -import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; import 'package:gitjournal/utils/logger.dart'; @@ -16,15 +13,15 @@ class SshKey { final String password; const SshKey({ - @required this.publicKey, - @required this.privateKey, - @required this.password, + required this.publicKey, + required this.privateKey, + required this.password, }); } final bool useDartKeyGen = false; -Future<SshKey> generateSSHKeys({@required String comment}) async { +Future<SshKey?> generateSSHKeys({required String comment}) async { if (useDartKeyGen) { //return generateSSHKeysDart(comment: comment); } else {} @@ -51,7 +48,7 @@ Future<SshKey> generateSSHKeysDart({@required String comment}) async { } */ -Future<SshKey> generateSSHKeysNative({@required String comment}) async { +Future<SshKey?> generateSSHKeysNative({required String comment}) async { try { var stopwatch = Stopwatch()..start(); var dir = await Directory.systemTemp.createTemp('keys'); diff --git a/lib/widgets/scroll_view_without_animation.dart b/lib/widgets/scroll_view_without_animation.dart index efd5ff3b..aa1743d0 100644 --- a/lib/widgets/scroll_view_without_animation.dart +++ b/lib/widgets/scroll_view_without_animation.dart @@ -1,5 +1,3 @@ -// @dart=2.9 - import 'package:flutter/material.dart'; class ScrollViewWithoutAnimation extends StatelessWidget { @@ -7,7 +5,7 @@ class ScrollViewWithoutAnimation extends StatelessWidget { final Axis scrollDirection; ScrollViewWithoutAnimation({ - @required this.child, + required this.child, this.scrollDirection = Axis.vertical, });