From b78583bb3526a51ecffab7a770b411f5f3993f8c Mon Sep 17 00:00:00 2001 From: Simon Choi <13610195+simc@users.noreply.github.com> Date: Tue, 22 Aug 2023 00:33:33 +0200 Subject: [PATCH] Improve readability --- README.md | 70 ++++++------- lcov_isar_test.info | 245 -------------------------------------------- 2 files changed, 35 insertions(+), 280 deletions(-) delete mode 100644 lcov_isar_test.info diff --git a/README.md b/README.md index f96aa76f9..4145f4a62 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ Hive is a lightweight and blazing-fast key-value database made for Flutter and D - ๐Ÿง  Think multi-tasking: Hive supports multiple isolates. - ๐Ÿ”‹ No need to pack extras: Hive comes with batteries included. -> ๐Ÿ A single bee can visit 5,000 flowers in a day! +> Bee fact: A single bee can visit 5,000 flowers in a day! -## Buzz into Action ๐Ÿฏ +## Buzz into Action ๐Ÿ Feeling the excitement? Great! Let's help you take your first flight with Hive. @@ -67,7 +67,7 @@ void main() async { #### ๐Ÿ And... Action! -๐ŸŽ‰ Woohoo! You're all set. Dive right in and let's get buzzing with Hive. +Woohoo! You're all set. Dive right in and let's get buzzing with Hive. ```dart import 'package:hive/hive.dart'; @@ -79,7 +79,7 @@ final name = box.get('name'); print('Name: $name'); ``` -> ๐Ÿ Honeybees can fly at a speed of up to 30 kilometers per hour! +> Bee fact: Honeybees can fly at a speed of up to 30 kilometers per hour! # ๐Ÿ“š Hive Handbook @@ -100,7 +100,7 @@ Want to jump to a specific section? Here's a handy table of contents: - [Transactions](#-transactions) - [FAQ](#-buzzworthy-questions-faq) -> ๐Ÿ Bees have five eyes โ€“ three simple eyes on top of the head, and two compound eyes, with numerous hexagonal facets. +> Bee fact: Bees have five eyes โ€“ three simple eyes on top of the head, and two compound eyes, with numerous hexagonal facets. ### ๐Ÿ“ฆ Opening Boxes @@ -123,7 +123,7 @@ There are optional parameters you can pass to `Hive.box()`: | `encryptionKey` | Hand over this key, and Hive will encrypt your box. Keep it safe! | | `maxSizeMiB` | The maximum size of the box in MiB. Go for a modest number. | -> ๐Ÿ Beeswax, which is secreted from the abdomen of worker bees, is used to construct the honeycomb. +> Bee fact: Beeswax, which is secreted from the abdomen of worker bees, is used to construct the honeycomb. ### ๐ŸŒ‚ Bidding Adieu: Closing Boxes @@ -131,7 +131,7 @@ It's not advised to close boxes that might be accessed again. This prevents unne To close a box just call `box.close()`. Wipe the box from the face of the earth with `box.deleteFromDisk()`. -> ๐Ÿ When a bee finds a good source of nectar, it flies back to the hive and shows its friends where the nectar source is by doing a dance. +> Bee fact: When a bee finds a good source of nectar, it flies back to the hive and shows its friends where the nectar source is by doing a dance. ### โœ๏ธ Filling the Honeycomb: Inserting Data @@ -163,7 +163,7 @@ Got a bucket of honey facts? Drop them all at once with `box.putAll()`: box.putAll({'favoriteFlower': 'Lavender', 'wingSpeed': 210}); ``` -> ๐Ÿ A single bee colony can produce anywhere from 30 to 100 pounds of honey in a year, depending on the availability of nectar sources. +> Bee fact: A single bee colony can produce anywhere from 30 to 100 pounds of honey in a year, depending on the availability of nectar sources. ### ๐Ÿ‘€ Extracting Honey... I mean, Data! @@ -182,7 +182,7 @@ final fav = box['favoriteFlower']; final moves = box['danceMoves'] ?? 'waggle'; ``` -> ๐Ÿ Worker bees are the only bees most people ever see flying around outside the hive. They're female, and their roles are to forage for food, build and protect the hive, and more. +> Bee fact: Worker bees are the only bees most people ever see flying around outside the hive. They're female, and their roles are to forage for food, build and protect the hive, and more. ### ๐Ÿงน Deleting Data @@ -199,7 +199,7 @@ Perhaps it's time for a complete reset, making space for a fresh batch of honey. box.clear(); ``` -> ๐Ÿ Bees have been around for more than 30 million years! Their long history predates the existence of humans and even dinosaurs. +> Bee fact: Bees have been around for more than 30 million years! Their long history predates the existence of humans and even dinosaurs. ### โœจ Using Boxes like Lists @@ -247,7 +247,7 @@ box[0] = 'Daffodil'; box[1] = 'Bluebell'; // This will get the bees in a whirl ``` -> ๐Ÿ To produce one pound of honey, a hive's bees must visit 2 million flowers and fly over 55,000 miles. +> Bee fact: To produce one pound of honey, a hive's bees must visit 2 million flowers and fly over 55,000 miles. ### ๐Ÿ›ก๏ธ Type safety @@ -260,7 +260,7 @@ box.put('RoseRumba', 'GoldenPollenParty'); box.put('TulipTango', 777); // Error - You can't fool the bees! ``` -> ๐Ÿ Bees have two stomachs. One is for eating, and the other is for storing nectar collected from flowers or water so they can carry it back to their hive. Talk about a sweet backpack! +> Bee fact: Bees have two stomachs. One is for eating, and the other is for storing nectar collected from flowers or water so they can carry it back to their hive. Talk about a sweet backpack! ### ๐Ÿงฉ Bee-yond the Basics: Non-primitive Objects @@ -304,7 +304,7 @@ box.put('BumbleID', bumble); print(box.get('BumbleID')); // Bumble - Worker ``` -> ๐Ÿ Bees are responsible for pollinating about one-third of the world's food crops. +> Bee fact: Bees are responsible for pollinating about one-third of the world's food crops. ### ๐Ÿชข Transactions @@ -338,49 +338,49 @@ box.write(() { print(box.get('honeyLevel')); // 5 ``` -> ๐Ÿ Bees can recognize human faces, and they can even be trained to associate a picture of a face with sweet treats! +> Bee fact: Bees can recognize human faces, and they can even be trained to associate a picture of a face with sweet treats! -### ๐ŸŒผ Buzzworthy Questions: FAQ +### ๐Ÿฏ Buzzworthy Questions: FAQ -#### To bee or not to bee: Hive or Isar? +#### ๐Ÿ To bee or not to bee: Hive or Isar? -> It's not always black and yellow! Both Hive and Isar have their sweet spots. Hive is a lightweight wrapper around Isar so if you are looking for a simple key-value store, Hive is the way to go. Isar is the way to go if you need queries, relations, and more advanced features. +> It's not always black and yellow! ๐Ÿ–ค๐Ÿ’› Both Hive and Isar have their sweet spots. Hive is a lightweight wrapper around Isar so if you are looking for a simple key-value store, Hive might be enough. Isar is the way to go if you need queries, relations, and more advanced features. -#### Will using Hive make my app as fast as a bee? +#### ๐Ÿš€ Will using Hive make my app as fast as a bee? -> While we can't promise your app will gain wings, Hive sure will give it the speed it deserves. Hive is very resource efficient and optimized for mobile devices. Flutter like a butterfly, sting like a bee! +> While we can't promise your app will gain wings, ๐Ÿฆ‹ Hive sure will give it the speed it deserves. Hive is very resource efficient and optimized for mobile devices. Flutter like a butterfly, sting like a bee! ๐Ÿ -#### Where in the beehive does Hive hide my honey... I mean, data? +#### ๐Ÿ—‚ Where in the beehive does Hive hide my honey... I mean, data? -> Remember the `defaultDirectory` we set at the beginning? That's where Hive stores your data in a file named `yourBoxName.isar` or `yourBoxName.sqlite`. +> Remember the `defaultDirectory` we set at the beginning? ๐Ÿ“ That's where Hive stores your data in a file named `yourBoxName.isar` or `yourBoxName.sqlite`. -#### I've got some bee-autiful images! Can I store them directly in Hive? +#### ๐Ÿ“ธ I've got some bee-autiful images! Can I store them directly in Hive? -> While you might be tempted to put those pics right into Hive, it's best to store your images and other binary data as files outside the Hive. You can then store the file path in Hive. Think of it like leaving honey out in the open; it's better to keep it neatly stored in the appropriate place. +> While you might be tempted to put those pics right into Hive, ๐Ÿ–ผ๏ธ it's best to store your images and other binary data as files outside Hive. You can then store the file path in Hive. Think of it like leaving honey out in the open; it's better to keep it neatly stored in the appropriate place. ๐Ÿบ -#### Yikes! What if my app meets an untimely demise (gets killed)? What becomes of my Hive? +#### ๐Ÿ˜ฒ Yikes! What if my app meets an untimely demise (gets killed)? What becomes of my Hive? -> No need for a bee-mergency! If your app buzzes off unexpectedly, Hive ensures that your data remains safe and sound. Transactions are atomic, so either all changes are applied or none of them. If an error occurs during a transaction, the box will not be changed. +> No need for a bee-mergency! ๐Ÿšจ If your app buzzes off unexpectedly, Hive ensures that your data remains safe and sound. Transactions are atomic, so either all changes are applied or none of them. If an error occurs during a transaction, the box will not be changed. -#### How does Hive keep our data safe from sticky fingers? +#### ๐Ÿ” How does Hive keep our data safe from sticky fingers? -> We've got the queen's guard on duty! If you encrypt your box Hive uses 256-bit AES in CBC mode. Every database page is safeguarded separately, ensuring your sweet stuff remains secure and only accessible to those with the right key. Buzz-worthy protection, right? +> We've got the queen's guard on duty! ๐Ÿ›ก๏ธ If you encrypt your box Hive uses 256-bit AES in CBC mode. Every database page is safeguarded separately, ensuring your sweet stuff remains secure and only accessible to those with the right key. Buzz-worthy protection, right? ๐Ÿ—๏ธ -#### When should I rally the troops and use transactions? +#### ๐Ÿค When should I rally the troops and use transactions? -> Just like a hive making big decisions together, you'll want to use transactions when you have several operations that should be executed together. If one fails, they all fail. It ensures your data stays consistent, safe, and buzzing in harmony! +> Just like a hive making big decisions together, ๐ŸŒ you'll want to use transactions when you have several operations that should be executed together. If one fails, they all fail. It ensures your data stays consistent, safe, and buzzing in harmony! ๐ŸŽถ -#### What if I'm allergic to bees? +#### ๐Ÿคฃ What if I'm allergic to bees? -> No worries! Hive is 100% sting-free, although we're pretty sure you'll get a buzz out of its performance. +> No worries! Hive is 100% sting-free, ๐Ÿšซ although we're pretty sure you'll get a buzz out of its performance. -#### Hive operations are synchronous. Doesn't that make the bee waltz a bit slow? +#### โณ Hive operations are synchronous. Doesn't that make the bee waltz a bit slow? -> Hive is incredibly fast an efficient. It's built on top of Isar, a high-performance database engine. If you want to keep database operations away from your UI isolate, you can use `compute()` or `Isolate.run()` to run them in a separate isolate. +> Hive is incredibly fast and efficient. ๐Ÿš„ It's built on top of Isar, a high-performance database engine. If you want to keep database operations away from your UI isolate, you can use `compute()` or `Isolate.run()` to run them in a separate isolate. -#### How many boxes should a wise beekeeper have? +#### ๐Ÿ“ฆ How many boxes should a wise beekeeper have? -> While the sky's the limit in the world of bees, in Hive, every box becomes a separate file. So, even if you're buzzing with excitement, it's wise not to overdo it. +> While the sky's the limit in the world of bees, ๐ŸŒŒ in Hive, every box becomes a separate file. So, even if you're buzzing with excitement, it's wise not to overdo it. ๐Ÿ“š ### ๐Ÿ“œ License diff --git a/lcov_isar_test.info b/lcov_isar_test.info deleted file mode 100644 index 753e901ab..000000000 --- a/lcov_isar_test.info +++ /dev/null @@ -1,245 +0,0 @@ -SF:lib/src/impl/type_registry.dart -DA:15,0 -DA:16,0 -DA:17,0 -DA:20,0 -DA:21,0 -DA:22,0 -DA:25,1 -DA:28,0 -DA:30,0 -DA:34,0 -DA:35,0 -DA:37,0 -DA:38,0 -DA:42,1 -DA:45,0 -DA:46,0 -DA:51,1 -DA:52,3 -DA:54,1 -DA:57,0 -DA:58,0 -DA:59,0 -DA:60,0 -DA:61,0 -DA:68,0 -DA:69,0 -DA:70,0 -DA:71,0 -DA:75,0 -DA:76,0 -DA:80,0 -DA:82,1 -DA:90,0 -DA:91,0 -LF:34 -LH:6 -end_of_record -SF:lib/src/impl/box_impl.dart -DA:4,2 -DA:11,1 -DA:12,2 -DA:14,1 -DA:15,2 -DA:17,1 -DA:18,2 -DA:20,1 -DA:21,2 -DA:23,0 -DA:24,0 -DA:26,0 -DA:27,0 -DA:29,0 -DA:31,0 -DA:32,0 -DA:33,0 -DA:35,0 -DA:37,0 -DA:41,0 -DA:45,1 -DA:47,1 -DA:48,3 -DA:49,1 -DA:51,1 -DA:53,1 -DA:56,0 -DA:57,0 -DA:59,0 -DA:63,1 -DA:65,6 -DA:68,1 -DA:70,3 -DA:73,2 -DA:76,1 -DA:79,1 -DA:80,4 -DA:83,1 -DA:85,4 -DA:88,1 -DA:90,4 -DA:91,1 -DA:94,1 -DA:96,3 -DA:99,2 -DA:102,1 -DA:105,1 -DA:107,1 -DA:108,1 -DA:109,1 -DA:110,1 -DA:112,1 -DA:116,1 -DA:118,2 -DA:120,1 -DA:121,1 -DA:123,1 -DA:125,2 -DA:127,1 -DA:129,3 -DA:132,1 -DA:134,2 -DA:135,1 -DA:138,1 -DA:139,1 -DA:140,2 -DA:141,2 -DA:142,1 -DA:144,3 -DA:145,2 -DA:151,1 -DA:153,1 -DA:154,1 -DA:155,1 -DA:157,2 -DA:159,1 -DA:161,2 -DA:163,1 -DA:164,2 -DA:165,1 -DA:170,1 -DA:172,2 -DA:173,1 -DA:174,2 -DA:175,2 -DA:179,2 -DA:183,1 -DA:185,2 -DA:187,4 -DA:189,2 -DA:192,1 -DA:194,2 -DA:197,2 -DA:201,1 -DA:203,1 -DA:204,1 -DA:205,1 -DA:206,1 -DA:208,1 -DA:212,1 -DA:214,2 -DA:215,1 -DA:217,1 -DA:218,2 -DA:219,1 -DA:220,2 -DA:221,3 -DA:222,1 -DA:223,1 -DA:225,1 -DA:227,2 -DA:231,1 -DA:233,2 -DA:234,2 -DA:238,1 -DA:239,1 -DA:240,1 -DA:241,2 -DA:243,3 -DA:244,2 -DA:245,0 -DA:252,1 -DA:253,2 -DA:254,1 -DA:255,2 -DA:256,2 -DA:259,1 -DA:261,2 -DA:265,1 -DA:267,2 -DA:268,1 -DA:269,2 -DA:270,2 -DA:274,2 -DA:278,1 -DA:280,2 -DA:281,1 -DA:282,2 -DA:283,1 -DA:284,2 -DA:285,2 -DA:288,1 -DA:290,2 -DA:294,1 -DA:296,2 -DA:297,4 -DA:301,1 -DA:303,2 -DA:304,3 -DA:306,2 -DA:311,1 -DA:313,2 -DA:314,1 -DA:315,1 -DA:316,1 -DA:318,3 -DA:319,1 -DA:323,1 -DA:325,2 -DA:326,2 -DA:331,4 -DA:333,2 -DA:334,2 -DA:339,0 -DA:341,0 -DA:342,0 -DA:346,0 -DA:348,0 -DA:349,0 -DA:352,1 -DA:354,3 -DA:355,2 -DA:358,0 -DA:360,0 -LF:174 -LH:151 -end_of_record -SF:lib/src/hive.dart -DA:5,3 -DA:6,3 -DA:38,0 -DA:42,0 -DA:56,1 -DA:62,2 -DA:64,0 -DA:67,0 -DA:68,0 -DA:74,0 -DA:80,1 -DA:82,1 -DA:88,1 -DA:89,2 -DA:94,0 -DA:95,0 -DA:96,0 -DA:103,0 -DA:104,0 -DA:105,0 -LF:20 -LH:8 -end_of_record -SF:lib/src/impl/frame.dart -DA:9,1 -LF:1 -LH:1 -end_of_record