Yooni
Yooni

Reputation: 61

I want to know this code base on ORM or ODM?

I want to ask you about this code is ORM base or ODM base? I use Firebase (NoSQL) Programming Language is Dart and Flutter.

Future _uploadFile(BuildContext context) async {
final firebaseStorageRef = FirebaseStorage.instance
    .ref()
    .child('post')
    .child('${DateTime.now().millisecondsSinceEpoch}.png');

final task = firebaseStorageRef.putFile(
  _image,
  StorageMetadata(contentType: 'image/png'),
);

final storageTaskSnapshot = await task.onComplete;

final downloadUrl = await storageTaskSnapshot.ref.getDownloadURL();

await Firestore.instance.collection('post').add(
    {
      'contents': textEditingController.text,
      'displayName': widget.user.displayName,
      'email': widget.user.email,
      'photoUrl': downloadUrl,
      'userPhotoUrl': widget.user.photoUrl,
    }
);

Upvotes: 1

Views: 150

Answers (1)

Thanawit Thampakorn
Thanawit Thampakorn

Reputation: 76

Since ODM maps between an object model and a document database, and Firebase Storage collects data as a document.

So, it would be considered an ODM base.

Upvotes: 0

Related Questions