Hitesh_jadhav

get_photo_url

Jun 20th, 2022 (edited)
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.14 KB | None | 0 0
  1. class Authmethods {
  2. final FirebaseAuth _auth = FirebaseAuth.instance;
  3. final FirebaseFirestore _firestore = FirebaseFirestore.instance;
  4.  
  5. Future<String> signUpUser({
  6. required String email,
  7. required String password,
  8. required String username,
  9. required String bio,
  10. required Uint8List file,
  11. }) async {
  12. String res = "Some error occured";
  13. try {
  14. if (email.isNotEmpty ||
  15. password.isNotEmpty ||
  16. username.isNotEmpty ||
  17. bio.isNotEmpty ||
  18. file.isNotEmpty) {
  19. String photoUrl = await StorageMethods()
  20. .uploadImageStorage('profilepics', file, false);
  21. UserCredential cred = await _auth.createUserWithEmailAndPassword(
  22. email: email, password: password);
  23. print(cred.user!.uid);
  24.  
  25. await _firestore.collection('users').doc(cred.user!.uid).set({
  26. 'username': username,
  27. 'uid': cred.user!.uid,
  28. 'email': email,
  29. 'bio': bio,
  30. 'followers': [],
  31. 'following': [],
  32. 'photoUrl': photoUrl
  33. });
  34. res = "Succes";
  35. }
  36. } catch (err) {
  37. res = err.toString() + "iiiiiiiiiiiiiiiiiiii";
  38. }
  39. return res;
  40. }
  41. }
  42.  
  43.  
  44.  
  45.  
  46. class StorageMethods {
  47. final FirebaseStorage _storage = FirebaseStorage.instance;
  48. final FirebaseAuth _auth = FirebaseAuth.instance;
  49.  
  50. Future<String> uploadImageStorage(
  51. String childname, Uint8List file, bool ispost) async {
  52. Reference ref =
  53. _storage.ref().child(childname).child(_auth.currentUser!.uid);
  54. UploadTask uploadTask = ref.putData(file);
  55.  
  56. TaskSnapshot snap = await uploadTask;
  57.  
  58. String downloadUrl = await snap.ref.getDownloadURL();
  59.  
  60. return downloadUrl;
  61. }
  62. }
  63.  
  64.  
  65.  
  66.  
  67. ERROR =
  68.  
  69. Launching lib\main.dart on MT2111 in debug mode...
  70. √ Built build\app\outputs\flutter-apk\app-debug.apk.
  71. Connecting to VM Service at ws://127.0.0.1:51203/Bg_aLR-chF4=/ws
  72. E/Parcel (25495): Reading a NULL string not supported here.
  73. I/ample.instagra(25495): ProcessProfilingInfo new_methods=2296 is saved saved_to_disk=1 resolve_classes_delay=5000
  74. E/Parcel (25495): Reading a NULL string not supported here.
  75. D/OplusBaseActivityThread(25495): post a callback for sC:android.view.Choreographer@16dd700 by pid:25495 tid:25495
  76. D/OplusBaseActivityThread(25495): pid:25495 tid:25495 doframe Callback
  77. I/AssistStructure(25495): Flattened final assist data: 476 bytes, containing 1 windows, 3 views
  78.  
  79. ════════ Exception caught by rendering library ═════════════════════════════════
  80. The following assertion was thrown during layout:
  81. A RenderFlex overflowed by 9.0 pixels on the bottom.
  82.  
  83. The relevant error-causing widget was
  84. Column
  85. You can inspect this widget using the 'Inspect Widget' button in the VS Code notification.
  86. The overflowing RenderFlex has an orientation of Axis.vertical.
  87. The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
  88.  
  89. Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
  90. This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.
  91.  
  92. The specific RenderFlex in question is: RenderFlex#39e47 relayoutBoundary=up4 OVERFLOWING
  93. ════════════════════════════════════════════════════════════════════════════════
  94. W/IInputConnectionWrapper(25495): getTextBeforeCursor on inactive InputConnection
  95. I/AssistStructure(25495): Flattened final assist data: 472 bytes, containing 1 windows, 3 views
  96. W/IInputConnectionWrapper(25495): getTextAfterCursor on inactive InputConnection
  97. W/IInputConnectionWrapper(25495): getSelectedText on inactive InputConnection
  98. I/AssistStructure(25495): Flattened final assist data: 476 bytes, containing 1 windows, 3 views
  99. I/AssistStructure(25495): Flattened final assist data: 468 bytes, containing 1 windows, 3 views
  100. I/DpmTcmClient(25495): RegisterTcmMonitor from: $Proxy1
  101. W/System (25495): Ignoring header X-Firebase-Locale because its value was null.
  102. D/FirebaseAuth(25495): Notifying id token listeners about a sign-out event.
  103. D/FirebaseAuth(25495): Notifying auth state listeners about a sign-out event.
  104. E/StorageUtil(25495): error getting token java.util.concurrent.ExecutionException: com.google.firebase.auth.FirebaseAuthInvalidUserException: There is no user record corresponding to this identifier. The user may have been deleted.
  105. I/TetheringManager(25495): registerTetheringEventCallback:com.example.instagram
  106. W/NetworkRequest(25495): no auth token for request
  107. E/StorageException(25495): StorageException has occurred.
  108. E/StorageException(25495): An unknown error occurred, please check the HTTP result code and inner exception for server response.
  109. E/StorageException(25495): Code: -13000 HttpResult: 400
  110. E/StorageException(25495): The server has terminated the upload session
  111. E/StorageException(25495): java.io.IOException: The server has terminated the upload session
  112. E/StorageException(25495): at com.google.firebase.storage.UploadTask.serverStateValid(UploadTask.java:339)
  113. E/StorageException(25495): at com.google.firebase.storage.UploadTask.shouldContinue(UploadTask.java:308)
  114. E/StorageException(25495): at com.google.firebase.storage.UploadTask.run(UploadTask.java:229)
  115. E/StorageException(25495): at com.google.firebase.storage.StorageTask.lambda$getRunnable$7$com-google-firebase-storage-StorageTask(StorageTask.java:1072)
  116. E/StorageException(25495): at com.google.firebase.storage.StorageTask$$ExternalSyntheticLambda3.run(Unknown Source:2)
  117. E/StorageException(25495): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  118. E/StorageException(25495): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  119. E/StorageException(25495): at java.lang.Thread.run(Thread.java:923)
  120. E/StorageException(25495): Caused by: java.io.IOException: { "error": { "code": 400, "message": "Your bucket has not been set up properly for Firebase Storage. Please visit 'https://console.firebase.google.com/project/instagram-clone-73843/storage/files' to automatically repair this issue and then retry. If the issue lasts longer than five minutes, you may have insufficient permissions to repair the project. You can check your permissions by visiting 'https://console.firebase.google.com/iam-admin/iam/project?project=instagram-clone-73843'." }}
  121. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.parseResponse(NetworkRequest.java:445)
  122. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.parseErrorResponse(NetworkRequest.java:462)
  123. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.processResponseStream(NetworkRequest.java:453)
  124. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:272)
  125. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:289)
  126. E/StorageException(25495): at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:76)
  127. E/StorageException(25495): at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:68)
  128. E/StorageException(25495): at com.google.firebase.storage.UploadTask.sendWithRetry(UploadTask.java:477)
  129. E/StorageException(25495): at com.google.firebase.storage.UploadTask.beginResumableUpload(UploadTask.java:276)
  130. E/StorageException(25495): at com.google.firebase.storage.UploadTask.run(UploadTask.java:224)
  131. E/StorageException(25495): ... 5 more
  132. E/StorageException(25495): StorageException has occurred.
  133. E/StorageException(25495): An unknown error occurred, please check the HTTP result code and inner exception for server response.
  134. E/StorageException(25495): Code: -13000 HttpResult: 400
  135. E/StorageException(25495): The server has terminated the upload session
  136. E/StorageException(25495): java.io.IOException: The server has terminated the upload session
  137. E/StorageException(25495): at com.google.firebase.storage.UploadTask.serverStateValid(UploadTask.java:339)
  138. E/StorageException(25495): at com.google.firebase.storage.UploadTask.shouldContinue(UploadTask.java:308)
  139. E/StorageException(25495): at com.google.firebase.storage.UploadTask.run(UploadTask.java:229)
  140. E/StorageException(25495): at com.google.firebase.storage.StorageTask.lambda$getRunnable$7$com-google-firebase-storage-StorageTask(StorageTask.java:1072)
  141. E/StorageException(25495): at com.google.firebase.storage.StorageTask$$ExternalSyntheticLambda3.run(Unknown Source:2)
  142. E/StorageException(25495): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  143. E/StorageException(25495): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  144. E/StorageException(25495): at java.lang.Thread.run(Thread.java:923)
  145. E/StorageException(25495): Caused by: java.io.IOException: { "error": { "code": 400, "message": "Your bucket has not been set up properly for Firebase Storage. Please visit 'https://console.firebase.google.com/project/instagram-clone-73843/storage/files' to automatically repair this issue and then retry. If the issue lasts longer than five minutes, you may have insufficient permissions to repair the project. You can check your permissions by visiting 'https://console.firebase.google.com/iam-admin/iam/project?project=instagram-clone-73843'." }}
  146. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.parseResponse(NetworkRequest.java:445)
  147. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.parseErrorResponse(NetworkRequest.java:462)
  148. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.processResponseStream(NetworkRequest.java:453)
  149. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:272)
  150. E/StorageException(25495): at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:289)
  151. E/StorageException(25495): at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:76)
  152. E/StorageException(25495): at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:68)
  153. E/StorageException(25495): at com.google.firebase.storage.UploadTask.sendWithRetry(UploadTask.java:477)
  154. E/StorageException(25495): at com.google.firebase.storage.UploadTask.beginResumableUpload(UploadTask.java:276)
  155. E/StorageException(25495): at com.google.firebase.storage.UploadTask.run(UploadTask.java:224)
  156. E/StorageException(25495): ... 5 more
  157. I/flutter (25495): [firebase_storage/unknown] An unknown error occurrediiiiiiiiiiiiiiiiiiii
  158. I/flutter (25495): Null check operator used on a null valueiiiiiiiiiiiiiiiiiiii
  159. E/Parcel (25495): Reading a NULL string not supported here.
  160. E/AndroidRuntime(29424): FATAL EXCEPTION: main
  161. E/AndroidRuntime(29424): Process: com.xiaomi.calendar, PID: 29424
  162. E/AndroidRuntime(29424): java.lang.NoClassDefFoundError: Failed resolution of: Lmiui/os/Build;
  163. E/AndroidRuntime(29424): at com.miui.calendar.util.LocalizationUtils.<clinit>(LocalizationUtils.java:20)
  164. E/AndroidRuntime(29424): at com.miui.calendar.util.LocalizationUtils.isLocalFeatureEnabled(LocalizationUtils.java:32)
  165. E/AndroidRuntime(29424): at com.miui.calendar.job.RemoteJobService.startJob(RemoteJobService.java:84)
  166. E/AndroidRuntime(29424): at com.miui.calendar.job.BaseJobService.onStartJob(BaseJobService.java:26)
  167. E/AndroidRuntime(29424): at android.app.job.JobService$1.onStartJob(JobService.java:64)
  168. E/AndroidRuntime(29424): at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:131)
  169. E/AndroidRuntime(29424): at android.os.Handler.dispatchMessage(Handler.java:106)
  170. E/AndroidRuntime(29424): at android.os.Looper.loop(Looper.java:262)
  171. E/AndroidRuntime(29424): at android.app.ActivityThread.main(ActivityThread.java:8248)
  172. E/AndroidRuntime(29424): at java.lang.reflect.Method.invoke(Native Method)
  173. E/AndroidRuntime(29424): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
  174. E/AndroidRuntime(29424): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:992)
  175. E/AndroidRuntime(29424): Caused by: java.lang.ClassNotFoundException: miui.os.Build
  176. E/AndroidRuntime(29424): ... 12 more
  177.  
  178.  
  179.  
Add Comment
Please, Sign In to add comment