Skip to content

Commit

Permalink
format(new post vm): remove imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Aderfish committed Apr 8, 2024
1 parent 8d9c882 commit bb51085
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/viewmodels/new_post_view_model.dart
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import "package:cloud_firestore/cloud_firestore.dart";
import "package:firebase_auth/firebase_auth.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:proxima/models/database/post/post_data.dart";
import "package:proxima/models/database/user/user_id_firestore.dart";
import "package:proxima/models/login_user.dart";
import "package:proxima/services/database/post_repository_service.dart";
import "package:proxima/services/database/user_repository_service.dart";
import "package:proxima/services/geolocation_service.dart";
import "package:proxima/viewmodels/login_view_model.dart";

Future<void> addPost(String title, String description, WidgetRef ref) async {
if(title.isEmpty || description.isEmpty) {
if (title.isEmpty || description.isEmpty) {
throw const FormatException("Title and description must not be empty");
}

final GeoPoint currPosition =
await ref.read(geoLocationServiceProvider).getCurrentPosition();
final LoginUser? user = ref.read(userProvider).value;

if(user == null){
if (user == null) {
throw Exception("User must be logged in before creating a post");
}

Expand Down
1 change: 0 additions & 1 deletion lib/views/pages/new_post/new_post_form.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "package:flutter/material.dart";
import "package:flutter_hooks/flutter_hooks.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:proxima/models/database/post/post_data.dart";
import "package:proxima/viewmodels/new_post_view_model.dart";

class NewPostForm extends HookConsumerWidget {
Expand Down

0 comments on commit bb51085

Please sign in to comment.