Code Monkey home page Code Monkey logo

rivaanranawat / flutter_twitter_clone Goto Github PK

View Code? Open in Web Editor NEW
246.0 7.0 119.0 1.47 MB

Full Stack Twitter Clone developed using Flutter, Appwrite, Riverpod. 9 Hour Tutorial link below👇

Home Page: https://www.youtube.com/watch?v=XnxZLhtkFeg

Kotlin 0.08% Ruby 1.57% Swift 1.11% Objective-C 0.02% Dart 71.94% CMake 10.93% C++ 12.46% C 0.83% HTML 1.07%
appwrite appwrite-auth appwrite-database appwrite-storage flutter flutter-apps flutter-tutorial riverpod riverpod-tutorial appwrite-realtime

flutter_twitter_clone's Introduction

Twitter Clone

Source Code for Full Stack Twitter App - Works on Android & iOS!

Features

  • Sign Up With Email, Password
  • Sign In With Email, Password
  • Tweeting Text
  • Tweeting Image
  • Tweeting Link
  • Hashtag identification & storage
  • Displaying tweets
  • Liking tweet
  • Retweeting
  • Commenting/Replying
  • Follow user
  • Search users
  • Display followers, following, recent tweets
  • Edit User Profile
  • Show tweets that have 1 hashtag
  • Twitter Blue
  • Notifications tab (replied to you, followed you, like your pic, retweeted)

YouTube

I have created a tutorial based on this, do check it out on my channel Rivaan Ranawat

Youtube Tutorial Image

Installation

After cloning this repository, migrate to flutter_twitter_clone folder. Then, follow the following steps:

  • Install Appwrite (Installation Steps here
  • Create Appwrite Project Locally
  • Create Android & iOS Apps in the Dashboard
  • Create Appwrite Database, Storage
  • Modify Roles in Auth, Database, Storage
  • Create Attributes for Tweets, Users, Notifications Collection
  • Copy the required ids & change it in lib/constants/appwrite_constants.dart
  • Change your IP Address in lib/constants/appwrite_constants.dart

Then run the following commands to run your app:

  flutter pub get
  open -a simulator (to get iOS Simulator)
  flutter run

Tech Used

Server: Appwrite Auth, Appwrite Storage, Appwrite Database, Appwrite Realtime

Client: Flutter, Riverpod

Feedback

If you have any feedback, please reach out to me at [email protected]

flutter_twitter_clone's People

Contributors

rivaanranawat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_twitter_clone's Issues

Code not working properly with Appwrite 9.0.1

Hi,
Thank you very much for this flutter twitter clone. I am learning to use Riverpod with AppWrite from your project.

However, I faced some issues while working with Appwrite 9 version in Flutter 3.10.6 (latest stable version). I am currently using Appwrite 1.3.8 local version. Also tested it with AppWrite Cloud. The model.Account was replaced by model.User in AuthAPI and AuthController files. Also the stack trace demangling was used.

void main() {
  runApp(
    const ProviderScope(
      child: MyApp(),
    ),
  );
  FlutterError.demangleStackTrace = (StackTrace stack) {
    if (stack is stack_trace.Trace) return stack.vmTrace;
    if (stack is stack_trace.Chain) return stack.toTrace().vmTrace;
    return stack;
  };
}

The issues faced are as follows:

  1. After a user logs out and another user logs in the profile page still shows the old user which is also used for the Tweets
  2. The error 'Null check operator used on a null value' is thrown for the following line in currentUserDetailsProvider definition:
  final currentUserId = ref.watch(currentUserAccountProvider).value!.$id;
  1. Also Realtime subscription is lost
flutter: subscription: ws://192.168.1.148:4003/v1/realtime?project=64b3ea1af0287f509fa5&channels%5B%5D=databases.64b3ecdbe0aea219dd76.collections.64c4cdd09a56cf2bd378.documents
flutter: subscription: null

Execution failed for task ':app:checkDebugDuplicateClasses'.

Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)

 Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Bad State: No Element

Hello sir,
first i want to thank you for this long hours of course.
sir, have followed the video and i hav being able to do something wonderful but how ever i keep geting an error, below is screenshot and with my code.

Simulator Screen Shot - iPhone 14 Pro Max - 2023-09-05 at 01 52 10

ref.watch(getRepliesToPostProvider(widget.postModel!)).when(
                  data: (post) {
                    return ref.watch(getLatestPostProvider).when(
                        data: (data) {
                          if (data.events.contains(
                            'databases.*.collections.${Common.postCollection}.documents.*.create',
                          )) {
                            post.insert(0, PostModel.fromMap(data.payload));
                          } else if (data.events.contains(
                            'databases.*.collections.${Common.postCollection}.documents.*.update',
                          )) {
                            final startingIndex =
                                data.events[0].lastIndexOf('documents.');
                            final endIndex =
                                data.events[0].lastIndexOf('.update');

                            var postId = data.events[0]
                                .substring(startingIndex + 10, endIndex);

                            var newPost = post
                                .where((element) => element.id == postId)
                                .first;

                            final postIndex = post.indexOf(newPost);
                            post.removeWhere((element) => element.id == postId);

                            newPost = PostModel.fromMap(data.payload);
                            post.insert(postIndex, newPost);
                          }

                          return Expanded(
                            child: ListView.builder(
                              padding: const EdgeInsets.all(0),
                              shrinkWrap: true,
                              scrollDirection: Axis.vertical,
                              physics: const ClampingScrollPhysics(),
                              itemCount: post.length,
                              itemBuilder: (BuildContext context, int index) {
                                var disPost = post[index];

                                final latestPost =
                                    PostModel.fromMap(data.payload);
                                bool isPostAlreadyPresent = false;
                                for (final postLoop in post) {
                                  if (postLoop.id == latestPost.id) {
                                    isPostAlreadyPresent = true;
                                    break;
                                  }
                                }

                                return ref
                                    .watch(userDetailsProvider(
                                        widget.postModel!.uid))
                                    .when(
                                        data: (user) {
                                          return Padding(
                                            padding: const EdgeInsets.only(
                                              left: 8.0,
                                              top: 2,
                                              right: 8,
                                              bottom: 2,
                                            ),
                                            child: Row(
                                              children: [
                                                CircularProfileAvatar(
                                                  user.profile,
                                                  radius: 20,
                                                  backgroundColor:
                                                      Colors.transparent,
                                                  borderWidth: 2,
                                                  initialsText: Text(
                                                    "AD",
                                                    style: TextStyle(
                                                        color: colorWhite),
                                                  ),
                                                  borderColor: colorWhite,
                                                  elevation: 5.0,
                                                  foregroundColor: Colors.brown
                                                      .withOpacity(0.5),
                                                  cacheImage: true,
                                                  imageFit: BoxFit.cover,
                                                  onTap: () {
                                                    print('adil');
                                                  },
                                                  showInitialTextAbovePicture:
                                                      false,
                                                ),
                                                const SizedBox(
                                                  width: 15,
                                                ),
                                                Expanded(
                                                  child: Text(disPost.text),
                                                ),
                                              ],
                                            ),
                                          );
                                        },
                                        error: (error, stk) => Container(),
                                        loading: () => Container());
                              },
                            ),
                          );
                        },
                        error: (error, stk) => ErrorText(
                              error: error.toString(),
                            ),
                        loading: () {
                          return Expanded(
                            child: ListView.builder(
                                padding: const EdgeInsets.all(0),
                                shrinkWrap: true,
                                scrollDirection: Axis.vertical,
                                physics: const ClampingScrollPhysics(),
                                itemCount: post.length,
                                itemBuilder: (BuildContext context, int index) {
                                  var disPost = post[index];

                                  return ref
                                      .watch(userDetailsProvider(
                                          widget.postModel!.uid))
                                      .when(
                                          data: (user) {
                                            return Padding(
                                              padding: const EdgeInsets.only(
                                                left: 8.0,
                                                top: 2,
                                                right: 8,
                                                bottom: 2,
                                              ),
                                              child: Row(
                                                children: [
                                                  CircularProfileAvatar(
                                                    user.profile,
                                                    radius: 20,
                                                    backgroundColor:
                                                        Colors.transparent,
                                                    borderWidth: 2,
                                                    initialsText: Text(
                                                      "AD",
                                                      style: TextStyle(
                                                          color: colorWhite),
                                                    ),
                                                    borderColor: colorWhite,
                                                    elevation: 5.0,
                                                    foregroundColor: Colors
                                                        .brown
                                                        .withOpacity(0.5),
                                                    cacheImage: true,
                                                    imageFit: BoxFit.cover,
                                                    onTap: () {
                                                      print('adil');
                                                    },
                                                    showInitialTextAbovePicture:
                                                        false,
                                                  ),
                                                  const SizedBox(
                                                    width: 15,
                                                  ),
                                                  Expanded(
                                                    child: Text(disPost.text),
                                                  ),
                                                ],
                                              ),
                                            );
                                          },
                                          error: (error, stk) => Container(),
                                          loading: () => Container());
                                }),
                          );
                        });
                  },
                  error: (error, stk) => ErrorText(
                    error: error.toString(),
                  ),
                  loading: () => const Loader(),
                ),

thank you very much

Screenshot 2023-09-05 at 1 53 01 AM
Screenshot 2023-09-05 at 1 53 35 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.