diff --git a/analysis_options.yaml b/analysis_options.yaml index abadf882..33330570 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -114,7 +114,7 @@ linter: - unnecessary_null_in_if_null_operators # - unnecessary_overrides # https://github.com/dart-lang/linter/issues/626 and https://github.com/dart-lang/linter/issues/627 - unnecessary_statements - # - unnecessary_this + - unnecessary_this - use_rethrow_when_possible # - use_setters_to_change_properties # not yet tested # - use_string_buffers # https://github.com/dart-lang/linter/pull/664 diff --git a/lib/apis/github.dart b/lib/apis/github.dart index e70bb9c1..5308143a 100644 --- a/lib/apis/github.dart +++ b/lib/apis/github.dart @@ -33,9 +33,9 @@ class GitHub implements GitHost { callback(GitHostException.OAuthFailed); } - this._accessCode = await _getAccessCode(authCode); - if (this._accessCode == null || this._accessCode.isEmpty) { - print("GitHub: AccessCode is invalid: " + this._accessCode); + _accessCode = await _getAccessCode(authCode); + if (_accessCode == null || _accessCode.isEmpty) { + print("GitHub: AccessCode is invalid: " + _accessCode); callback(GitHostException.OAuthFailed); } diff --git a/lib/gitapp.dart b/lib/gitapp.dart index daecb313..444303d7 100644 --- a/lib/gitapp.dart +++ b/lib/gitapp.dart @@ -28,13 +28,13 @@ class GitApp extends StatelessWidget { void _sendSuccess() { var text = "Success"; - this._scaffoldKey.currentState + _scaffoldKey.currentState ..removeCurrentSnackBar() ..showSnackBar(SnackBar(content: Text(text))); } void _sendError(String text) { - this._scaffoldKey.currentState + _scaffoldKey.currentState ..removeCurrentSnackBar() ..showSnackBar(SnackBar(content: Text("ERROR: " + text))); } diff --git a/lib/screens/githostsetup_autoconfigure.dart b/lib/screens/githostsetup_autoconfigure.dart index d008d4f1..da509adb 100644 --- a/lib/screens/githostsetup_autoconfigure.dart +++ b/lib/screens/githostsetup_autoconfigure.dart @@ -50,7 +50,7 @@ class GitHostSetupAutoConfigureState extends State { GitRepo repo; try { - this.setState(() { + setState(() { _message = "Creating private repo"; }); @@ -61,18 +61,18 @@ class GitHostSetupAutoConfigureState extends State { rethrow; } - this.setState(() { + setState(() { _message = "Using existing repo"; }); repo = await gitHost.getRepo("journal"); } - this.setState(() { + setState(() { _message = "Generating SSH Key"; }); var publicKey = await generateSSHKeys(comment: "GitJournal"); - this.setState(() { + setState(() { _message = "Adding as a Deploy Key"; }); await gitHost.addDeployKey(publicKey, repo.fullName); @@ -105,7 +105,7 @@ class GitHostSetupAutoConfigureState extends State { @override Widget build(BuildContext context) { if (_configuringStarted) { - if (this.errorMessage == null || this.errorMessage.isEmpty) { + if (errorMessage == null || errorMessage.isEmpty) { return GitHostSetupLoadingPage(_message); } diff --git a/lib/screens/githostsetup_button.dart b/lib/screens/githostsetup_button.dart index 623e1833..f5a246a7 100644 --- a/lib/screens/githostsetup_button.dart +++ b/lib/screens/githostsetup_button.dart @@ -24,7 +24,7 @@ class GitHostSetupButton extends StatelessWidget { style: Theme.of(context).textTheme.button, ), color: Theme.of(context).primaryColor, - onPressed: this._onPressedWithAnalytics, + onPressed: _onPressedWithAnalytics, ), ); } else { @@ -38,7 +38,7 @@ class GitHostSetupButton extends StatelessWidget { ), icon: Image.asset(iconUrl, width: 32, height: 32), color: Theme.of(context).primaryColor, - onPressed: this._onPressedWithAnalytics, + onPressed: _onPressedWithAnalytics, ), ); } diff --git a/lib/screens/githostsetup_clone.dart b/lib/screens/githostsetup_clone.dart index 80bad29b..16817389 100644 --- a/lib/screens/githostsetup_clone.dart +++ b/lib/screens/githostsetup_clone.dart @@ -12,7 +12,7 @@ class GitHostSetupGitClone extends StatelessWidget { @override Widget build(BuildContext context) { - if (this.errorMessage == null || this.errorMessage.isEmpty) { + if (errorMessage == null || errorMessage.isEmpty) { return GitHostSetupLoadingPage("Cloning ..."); } diff --git a/lib/screens/githostsetup_clone_url.dart b/lib/screens/githostsetup_clone_url.dart index ee2eada1..c8246220 100644 --- a/lib/screens/githostsetup_clone_url.dart +++ b/lib/screens/githostsetup_clone_url.dart @@ -33,7 +33,7 @@ class GitCloneUrlPageState extends State { _formKey.currentState.save(); var url = sshUrlKey.currentState.value; - this.widget.doneFunction(url.trim()); + widget.doneFunction(url.trim()); inputFormFocus.unfocus(); } }; @@ -129,7 +129,7 @@ class GitCloneUrlKnownProviderPageState _formKey.currentState.save(); var url = sshUrlKey.currentState.value; - this.widget.doneFunction(url.trim()); + widget.doneFunction(url.trim()); inputFormFocus.unfocus(); } }; diff --git a/lib/screens/githostsetup_screens.dart b/lib/screens/githostsetup_screens.dart index a0dad6f4..a1cb9e96 100644 --- a/lib/screens/githostsetup_screens.dart +++ b/lib/screens/githostsetup_screens.dart @@ -466,7 +466,7 @@ class GitHostSetupScreenState extends State { parameters: {}, ); Navigator.pop(context); - this.widget.onCompletedFunction(folder); + widget.onCompletedFunction(folder); } } diff --git a/lib/screens/githostsetup_sshkey.dart b/lib/screens/githostsetup_sshkey.dart index 22e9eee9..8c4b9d98 100644 --- a/lib/screens/githostsetup_sshkey.dart +++ b/lib/screens/githostsetup_sshkey.dart @@ -19,7 +19,7 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget { @override Widget build(BuildContext context) { - if (this.publicKey == null || this.publicKey.isEmpty) { + if (publicKey == null || publicKey.isEmpty) { return GitHostSetupLoadingPage("Generating SSH Key ..."); } @@ -67,7 +67,7 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget { SizedBox(height: 8.0), GitHostSetupButton( text: "Clone Repo", - onPressed: this.doneFunction, + onPressed: doneFunction, ), ], ); @@ -93,7 +93,7 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget { @override Widget build(BuildContext context) { - if (this.publicKey == null || this.publicKey.isEmpty) { + if (publicKey == null || publicKey.isEmpty) { return GitHostSetupLoadingPage("Generating SSH Key ..."); } @@ -136,7 +136,7 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget { SizedBox(height: 8.0), GitHostSetupButton( text: "Clone Repo", - onPressed: this.doneFunction, + onPressed: doneFunction, ), ], ); diff --git a/lib/screens/note_editor.dart b/lib/screens/note_editor.dart index 4633d105..33aec355 100644 --- a/lib/screens/note_editor.dart +++ b/lib/screens/note_editor.dart @@ -57,8 +57,8 @@ class NoteEditorState extends State { icon: Icon(Icons.check), onPressed: () { final stateContainer = StateContainer.of(context); - this.note.body = _textController.text; - if (this.note.body.isNotEmpty) { + note.body = _textController.text; + if (note.body.isNotEmpty) { newNote ? stateContainer.addNote(note) : stateContainer.updateNote(note); diff --git a/lib/state_container.dart b/lib/state_container.dart index 16b2f408..81cb2e74 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -151,7 +151,7 @@ class StateContainerState extends State { } print("Starting to syncNotes"); - this.noteRepo.sync().then((loaded) { + noteRepo.sync().then((loaded) { print("NotesRepo Synced: " + loaded.toString()); _loadNotesFromDisk(); }).catchError((err) { @@ -230,9 +230,9 @@ class StateContainerState extends State { void completeGitHostSetup(String subFolder) { setState(() async { - this.appState.remoteGitRepoConfigured = true; - this.appState.remoteGitRepoFolderName = "journal"; - this.appState.remoteGitRepoSubFolder = subFolder; + appState.remoteGitRepoConfigured = true; + appState.remoteGitRepoFolderName = "journal"; + appState.remoteGitRepoSubFolder = subFolder; await migrateGitRepo( fromGitBasePath: appState.localGitRepoPath, @@ -255,7 +255,7 @@ class StateContainerState extends State { void completeOnBoarding() { setState(() { - this.appState.onBoardingCompleted = true; + appState.onBoardingCompleted = true; _persistConfig(); }); } diff --git a/lib/storage/file_storage.dart b/lib/storage/file_storage.dart index 441c0f12..15a6a17c 100644 --- a/lib/storage/file_storage.dart +++ b/lib/storage/file_storage.dart @@ -19,9 +19,9 @@ class FileStorage implements NoteRepository { @required this.baseDirectory, @required this.noteSerializer, }) { - assert(this.baseDirectory != null); - assert(this.baseDirectory.isNotEmpty); - print("FileStorage Directory: " + this.baseDirectory); + assert(baseDirectory != null); + assert(baseDirectory.isNotEmpty); + print("FileStorage Directory: " + baseDirectory); } @override diff --git a/lib/storage/git_storage.dart b/lib/storage/git_storage.dart index 25418956..88a7880c 100644 --- a/lib/storage/git_storage.dart +++ b/lib/storage/git_storage.dart @@ -40,9 +40,9 @@ class GitNoteRepository implements NoteRepository { var baseDir = _fileStorage.baseDirectory; var filePath = result.noteFilePath.replaceFirst(baseDir + "/", ""); - await gitAdd(this.dirName, filePath); + await gitAdd(dirName, filePath); await gitCommit( - gitFolder: this.dirName, + gitFolder: dirName, authorEmail: Settings.instance.gitAuthorEmail, authorName: Settings.instance.gitAuthor, message: commitMessage, @@ -62,9 +62,9 @@ class GitNoteRepository implements NoteRepository { var baseDir = _fileStorage.baseDirectory; var filePath = result.noteFilePath.replaceFirst(baseDir + "/", ""); - await gitRm(this.dirName, filePath); + await gitRm(dirName, filePath); await gitCommit( - gitFolder: this.dirName, + gitFolder: dirName, authorEmail: Settings.instance.gitAuthorEmail, authorName: Settings.instance.gitAuthor, message: "Removed Journal entry", @@ -74,7 +74,7 @@ class GitNoteRepository implements NoteRepository { } Future resetLastCommit() async { - await gitResetLast(this.dirName); + await gitResetLast(dirName); return NoteRepoResult(error: false); } @@ -91,13 +91,13 @@ class GitNoteRepository implements NoteRepository { @override Future sync() async { try { - await gitPull(this.dirName); + await gitPull(dirName); } on GitException catch (ex) { print(ex); } try { - await gitPush(this.dirName); + await gitPush(dirName); } on GitException catch (ex) { print(ex); rethrow;