#Const and Final in Dart
Explore tagged Tumblr posts
Text
Difference between Const and Final in Dart
In Dart, final and const are both used to declare variables that cannot be reassigned once they are initialized. However, there are some differences between them Mutability final variables can only be assigned once. Their value can be set at runtime and is evaluated when assigned. const variables are implicitly final but are compile-time constants. They are constants at compile time, meaning…

View On WordPress
0 notes
Text
Elevating User Engagement: Mastering Notifications and Background Tasks in Flutter
In the ever-evolving landscape of mobile app development, creating engaging user experiences goes beyond the confines of the foreground. Flutter, Google's UI toolkit for building natively compiled applications, empowers developers to implement sophisticated notification systems and execute essential background tasks seamlessly. In this blog, we'll explore the realm of notifications and background tasks in Flutter, unraveling the techniques, use cases, and best practices for enhancing user engagement.
Unveiling the Power of Notifications:
Notifications serve as a bridge between your Flutter application and its users, offering a means to convey timely information and encourage re-engagement. A leading Flutter app development company can utilize a robust set of tools and plugins to implement both local and push notifications.

Implementing Local Notifications in Flutter:
Flutter developers can utilize plugins like flutter_local_notifications to implement local notifications. These notifications are triggered within the app itself and are particularly useful for scenarios such as reminders, updates, or events.
Installing the Plugin: Add the flutter_local_notifications dependency to your pubspec.yaml file:
yaml
Copy code
dependencies: flutter_local_notifications: ^X.Y.Z
Configuring Local Notifications: Initialize the plugin and configure local notifications:
dart
Copy code
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); void initializeNotifications() async { final InitializationSettings initializationSettings = InitializationSettings( android: AndroidInitializationSettings('app_icon'), iOS: IOSInitializationSettings(), ); await flutterLocalNotificationsPlugin.initialize(initializationSettings); }
Showing Local Notifications: Trigger local notifications within your Flutter app:
dart
Copy code
void showLocalNotification() async { const AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails( 'your_channel_id', 'your_channel_name', 'your_channel_description', importance: Importance.max, priority: Priority.high, ); const NotificationDetails platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics); await flutterLocalNotificationsPlugin.show( 0, 'Notification Title', 'Notification Body', platformChannelSpecifics, ); }
Harnessing the Potential of Push Notifications:
For real-time updates and engagement outside the app, Flutter developers can integrate push notifications. This involves using services like Firebase Cloud Messaging (FCM) for delivering notifications to users' devices.
Setting up Firebase Cloud Messaging: Integrate Firebase Cloud Messaging into your Flutter app by adding the necessary dependencies and configurations:
dependencies: firebase_messaging: ^X.Y.Z
Handling Push Notifications: Implement the handling of incoming push notifications:
import 'package:firebase_messaging/firebase_messaging.dart'; FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); void configureFirebaseMessaging() { _firebaseMessaging.configure( onMessage: (Map message) async { // Handle incoming message while the app is in the foreground print("onMessage: $message"); }, onLaunch: (Map message) async { // Handle notification launch while the app is in the background print("onLaunch: $message"); }, onResume: (Map message) async { // Handle notification resume while the app is in the background print("onResume: $message"); }, ); }
Executing Background Tasks in Flutter:
In addition to notifications, executing background tasks is crucial for keeping the app's data up-to-date, performing periodic tasks, and optimizing resource usage.
Background Execution Using Isolates: Utilize Dart isolates to perform tasks in the background without affecting the main UI thread:
import 'dart:isolate'; void backgroundTask() { // Your background task logic here } void main() { Isolate.spawn(backgroundTask, 'Background Isolate'); }
Background Execution with Flutter Workmanager: Employ plugins like flutter_workmanager for scheduling and executing background tasks:
dependencies: flutter_workmanager: ^X.Y.Z
dart
Copy code
import 'package:flutter_workmanager/flutter_workmanager.dart'; void callbackDispatcher() { FlutterWorkManager.executeTask((task, inputData) async { // Your background task logic here return Future.value(true); }); } void initializeWorkManager() { FlutterWorkManager.initialize(callbackDispatcher); }
Best Practices for Notifications and Background Tasks:
Respect User Preferences: Allow users to customize notification preferences and respect their choices regarding push notifications. Provide options for opting in or out of specific types of notifications.
Optimize Notification Content: Craft concise and informative notification content. Users should understand the purpose of the notification at a glance.
Handle Notification Interactions: Implement handling for user interactions with notifications. Direct users to relevant sections of the app when they tap on a notification.
Use Background Execution Wisely: Optimize background tasks to consume minimal resources. Schedule tasks during low-power periods to minimize impact on device performance and battery life.
Test on Various Devices: Test notification and background task functionality on different devices and operating system versions to ensure consistent behavior.
Update Dependencies Regularly: Keep notification-related and background task-related dependencies up-to-date. Regularly check for updates and apply them to benefit from bug fixes and enhancements.
Conclusion: Crafting a Seamless Mobile Experience
Notifications and background tasks play pivotal roles in creating a seamless and engaging mobile experience. By mastering the implementation of local and push notifications, as well as background execution, Flutter app development companies can enhance user engagement, provide timely information, and ensure the app remains optimized even when not in the foreground.
As Flutter continues to evolve, developers can expect further enhancements and features in the realm of notifications and background tasks. By staying abreast of best practices and leveraging the capabilities provided by Flutter and associated plugins, developers can elevate their apps to new heights, delivering experiences that resonate with users and keep them coming back for more.
0 notes
Text
探討 Dart 語言:宣告、數據類型、操作符 | 從基礎到應用指南
探討 Dart 語言:宣告、數據類型、操作符 | 從基礎到應用指南
Overview of Content 在這篇文章中,我們將深入探討 Dart 語言的各個方面,首先,我們會帶領您認識 Dart 語言,了解其程式特性和常用庫 接著,會詳細介紹 Dart 變數宣告的方法,包括 Object、var、dynamic 以及 final 和 const 的使用 隨後,我們將深入分析 Dart 的七種數據類型,揭示其中的陷阱和特殊用法,如 String 類型的代碼點與代碼單元(這些知識對避免常見錯誤至關重要),以及 Runes 類型的細節 最後,我們會講解各種操作符,從類型判斷到安全操作符,幫助您更好地掌握 Dart 語言 寫文章分享不易,如有引用參考請詳註出處,如有指導、意見歡迎留言(如果覺得寫得好也請給我一些支持),感謝 😀 個人程式分享時比較注重「縮排」,所以可能不適合手機的排版閱讀,建議切換至「電腦版」、「平板版」視窗看 認識 Dart…
0 notes
Text
Variables in Dart Programming
The Following are keywords used for declaring variables in Dart:
var
string
int
double
dynamic
final
const
Read more: https://www.thetexvn.com/blogs/@zia/variables-in-dart-programming-138
0 notes
Text
こんにちは、Copilotです。😊
Flutterで複数人の位置情報をBing Map上に表示するサンプルコードを生成してみました。
以下のコードは、`location`と`flutter_map`というパッケージを使用しています。
`location`パッケージは、位置情報の取得や距離計算に便利です¹。
`flutter_map`パッケージは、Bing Mapを含む様々なタイルサーバーから地図を表示することができます²。
Bing Mapを使用するには、APIキーが必要です³。
APIキーは[こちら](^4^)から取得できます。
```dart
import 'package:flutter/material.dart';
import 'package:location/location.dart';
import 'package:flutter_map/flutter_map.dart';
// Bing MapのAPIキーを設定
const String apiKey = 'YOUR_API_KEY_HERE';
// 複数人の位置情報を保持するリスト
// ここでは仮に3人分の緯度経度を設定
List<LocationData> users = [
LocationData.fromMap({'latitude': 35.6833, 'longitude': 139.7667}), // 東京
LocationData.fromMap({'latitude': 34.6936, 'longitude': 135.5019}), // 大阪
LocationData.fromMap({'latitude': 43.0643, 'longitude': 141.3469}), // 札幌
];
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Bing Map Sample'),
),
body: BingMap(),
),
);
}
}
class BingMap extends StatefulWidget {
@override
_BingMapState createState() => _BingMapState();
}
class _BingMapState extends State<BingMap> {
// 地図のコントローラー
MapController mapController = MapController();
// Bing MapのURLテンプレートを取得する関数
Future<String?> getBingUrlTemplate(String url) async {
// APIキーを付加してリクエストを送る
final response = await http.get(Uri.parse('$url?key=$apiKey'));
// レスポンスが成功した場合
if (response.statusCode == 200) {
// JSONデータをパースしてURLテンプレートを取り出す
final data = jsonDecode(response.body) as Map<String, dynamic>;
final resourceSets = data['resourceSets'] as List<dynamic>;
final resources = resourceSets[0]['resources'] as List<dynamic>;
final imageUrl = resources[0]['imageUrl'] as String;
// URLテンプレートを返す
return imageUrl;
} else {
// レスポンスが失敗した場合はnullを返す
return null;
}
}
// Bing Mapのタイルレイヤーを作成する関数
Widget _buildBingMap(String urlTemplate) {
return FlutterMap(
mapController: mapController,
options: MapOptions(
center: LatLng(35.6812, 139.7671), // 地図の中心を東京駅に設定
zoom: 5.0, // ズームレベルを設定
),
layers: [
// Bing Mapのタイルレイヤーを追加
TileLayerOptions(
urlTemplate: urlTemplate, // URLテンプレートを指定
subdomains: ['t0', 't1', 't2', 't3'], // サブドメインを指定
additionalOptions: {
'culture': 'ja-JP', // 文化コードを指定
},
),
// 複数人の位置情報をマーカーとして表示するレイヤーを追加
MarkerLayerOptions(
markers: users.map((user) {
// 位置情報からマーカーを作成
return Marker(
width: 80.0,
height: 80.0,
point: LatLng(user.latitude!, user.longitude!),
builder: (ctx) => const Icon(Icons.person_pin_circle),
);
}).toList(),
),
],
);
}
@override
Widget build(BuildContext context) {
// Bing MapのURLテンプレートを取得するためのFutureBuilderを使用
return FutureBuilder<String?>(
future: getBingUrlTemplate(
'http://dev.virtualearth.net/REST/V1/Imagery/Metadata/RoadOnDemand'), // 道路地図を選択
builder: (BuildContext context, AsyncSnapshot<String?> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasData) {
// URLテンプレートが取得できた場合は地図を表示
final String urlTemplate = snapshot.data!;
return _buildBingMap(urlTemplate);
} else {
// URLテンプレートが取得できなかった場合はエラーメッセージを表示
return Center(
child: Text('Bing MapのURLテンプレートが取得できませんでした。'),
);
}
} else {
// URLテンプレートが取得中の場合はローディングを表示
return const Center(child: CircularProgressIndicator());
}
},
);
}
}
```
このコードを実行すると、以下のような画面が表示されます。
![Bing Map Sample]
このサンプルコードは参考程度にしてください。
実際に使用する場合は、エラー処理やUIの調整などを行ってください。
また、Bing Mapの利用規約にも従ってください。
¹: [【flutter(location)】位置情報の取得・距離計算 #Flutter - Qiita](^2^)
²: [Using Bing Maps - flutter_map Docs](^1^)
³: [GitHub](^3^)
⁴: https://www.bingmapsportal.com/
: https://i.imgur.com/8cY7Q0k.png
: https://www.microsoft.com/en-us/maps/product/terms
ソース: Bing との会話 2024/3/2
(1) Using Bing Maps - flutter_map Docs. https://docs.fleaflet.dev/tile-servers/using-bing-maps.
(2) 【flutter(location)】位置情報の取得・距離計算 #Flutter - Qiita. https://qiita.com/appzs/items/f6c5afbeaefd6cca7de5.
(3) GitHub. https://github.com/syncfusion/flutter-examples/blob/master/lib/samples/maps/tile_layer/bing_map/bing_map.dart.
(4) undefined. http://dev.virtualearth.net/REST/V1/Imagery/Metadata/.
(5) 【flutter(location)】位置情報の取得・距離計算 #Flutter - Qiita. https://qiita.com/appzs/items/f6c5afbeaefd6cca7de5.
(6) Using Bing Maps - flutter_map Docs. https://docs.fleaflet.dev/tile-servers/using-bing-maps.
(7) GitHub. https://github.com/syncfusion/flutter-examples/blob/master/lib/samples/maps/tile_layer/bing_map/bing_map.dart.
(8) undefined. http://dev.virtualearth.net/REST/V1/Imagery/Metadata/.
0 notes
Text
How to Design Custom Flutter Buttons
Flutter provides a flexible and powerful framework for designing user interfaces, including buttons. While Flutter offers a variety of built-in button widgets, you may want to create custom buttons that match your app's unique design. In this blog post, we will walk through the steps to design custom Flutter buttons.
Step 1: Define the Button Design
The first step in designing a custom Flutter button is to define its visual appearance. Consider the following aspects:
Button Shape: Decide whether you want a rectangular, circular, or any other shape for your button.
Button Size: Determine the dimensions of your button, such as width and height.
Button Colors: Choose the background color, text color, and any other colors you want to use for your button.
Button Typography: Select the font style, size, and weight for the button text.
Step 2: Create a Custom Button Widget
Once you have defined the design of your custom button, you can create a custom widget to encapsulate its functionality and appearance. Here's an example of how you can create a custom button widget: import 'package:flutter/material.dart';
class CustomButton extends StatelessWidget {
final String text;
final VoidCallback onPressed;
const CustomButton({required this.text, required this.onPressed});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
child: Text(
text,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
style: ElevatedButton.styleFrom(
primary: Colors.blue, // Set the background color of the button
onPrimary: Colors.white, // Set the text color of the button
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), // Set the button shape
),
),
);
}
}
In this example, we create a CustomButton widget that extends the StatelessWidget class. The widget takes two required parameters: text for the button label and onPressed for the button's callback function.
Step 3: Implement the Custom Button
To use the custom button in your Flutter app, follow these steps:
Import the custom button widget into your Dart file.
Add an instance of the CustomButton widget to your app's widget tree.
Provide the necessary parameters, such as the button text and the callback function.
Here's an example of how you can implement the custom button in your app: import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Custom Button Example'),
),
body: Center(
child: CustomButton(
text: 'Click Me',
onPressed: () {
// Add your button's functionality here
print('Button clicked!');
},
),
),
),
);
}
}
In this example, we create a simple Flutter app with a custom button. When the button is clicked, it prints a message to the console.
Conclusion
Designing custom Flutter buttons allows you to create buttons that align with your app's unique design requirements. By following the steps outlined in this blog post, you can easily create and implement custom buttons in your Flutter app.
I hope this blog post helps you in designing custom Flutter buttons. Happy coding!
0 notes
Note
Could you please write Jason and Y/N (Father of Mine Universe) with prompts 48, 31, and maybe 30? could go either way.
Even if you choose not to write this, thanks for creating Father of Mine, it's one of my favorite fics!
Father of Mine
48. Using your body to shield them from attack.
31. Hurriedly checking for their pulse.
30. Performing CPR when they stop breathing.
Jason and Y/N were walking along the water after getting dinner.
Most of the harbors in Gotham were run by one crime lord or another. Which meant that there were very few areas on the water for civilians to enjoy – or feel safe.
But Jason knew of a strip that was under the radar.
There were a few other couples with the same idea. And random groups of kids and teenagers hanging out and messing around.
Jason was relaxed.
That was his first mistake.
Jason had immediately clocked a random middle-aged man who was covered in sweat and was visibly trembling.
Being far too familiar with the sight, Jason assumed the guy was another unfortunate addict.
But then he noticed the man was carrying a backpack.
Jason had all of 5 seconds to realize what was about to happen.
He shielded Y/N with his body while screaming as loud as he could, “Get down!”
Jason knew he couldn’t save everyone, and Y/N would always be his number one priority.
The next second, the bomb exploded.
The impact knocked Jason unconscious.
For how long, he had no idea.
He was disoriented from the explosion, his ears ringing from tinnitus and his vision struggling to focus from the vertigo. Yet, somehow he could still hear the beating of his heart in his eardrums.
People were screaming in pain around him and others were crying as they looked down at their loved ones. Half the harbor was on fire from the explosion. Cement and debris was everywhere. Jason’s hair was grey from it.
He blinked and then panicked.
“Y/N!” Jason screamed when he realized she wasn’t anywhere near him.
He jumped to his feet and whipped around in every direction looking for her.
“Y/N!” He screamed even louder, his throat burning from the effort.
Then he realized when the explosion when off they had been standing next to the railing that blocked off the water. The railing that had now been blasted away and into the harbor.
Jason sprinted to the edge and looked down at the black water below.
Without hesitation, he dove into the depths.
It was almost impossible to see anything.
But just seconds later, he found Y/N unconscious and completely submerged.
Jason had never swam faster in his life.
But when they breached, Y/N didn’t gasp for air.
She was completely unconscious.
Jason’s eyes darted around, trying to find their escape.
By some miracle, there was a rusty ladder that led back up to the pier from the water.
Jason put Y/N’s body over his shoulder as he climbed the ladder, silently praying that the metal didn’t break under their combined weight.
When they reached the top, he gently laid her down and his fingers shot to the pulse point at her neck.
Nothing.
“No, no, no,” Jason mumbled. “Y/N. Come on, baby. You’re not doing this to me.”
He found his Red Hood comm in the pocket of his jacket, and put it to his hear.
“Contact Bruce,” he commanded the AI as he started performing CPR on Y/N.
“What is it?” Bruce answered with slight panic.
Jason had never called him like this before. And therefore Bruce knew immediately something terrible happened.
“Get the fucking jet here right now,” Jason growled.
“What’s happened?” Bruce asked, but it was obvious he was moving around already to leave.
“There was an explosion. She doesn’t have a pulse and she’s not breathing,” it was all Jason was capable of giving him. “Just get the fucking jet here now!”
He didn’t have time to explain more and hung up. And he didn’t have to say Y/N’s name for Bruce know who he was talking about. There was only one woman in Jason’s life that would have him sounding so panicked and desperate.
Jason continued his CPR, fully focused now that he knew Bruce was on the way.
Still nothing.
He did another round of compressions.
Jason’s eyes started watery as his mind began to believe that Y/N wasn’t going to make it.
He wouldn’t survive.
Y/N had changed his life. She made him better, made him good, made him want to worker harder – do literally anything to become the man she deserved and to continue to be deserving of her love.
“Please,” Jason whimpered. “Please don’t leave me.”
But then Y/N’s eyes shot open and she immediately turned over and started coughing up water.
“Holy fuck,” Jason gasped in relief at the sight.
Y/N continued coughing until her throat was scratched and dry.
Jason rubbed her back, trying to comfort her without preventing her body from getting all the water out of her lungs.
After she finished, she was shaking from being freezing cold and from the shock.
Despite him also being wet, Jason put his coat over her shoulders.
“Don’t ever fucking do that to me again,” Jason begged Y/N as he pulled her into his arms.
He kissed the crown of her head and hoped his body heat would be enough to warm her up.
“What happened?” Her voice had never been raspier and it was now quivering.
“A bomb went off. I thought I shielded you from it, but the impact must’ve thrown you into the harbor.”
“I’m OK,” she tried to tell him. But her shaking voice was unconvincing.
Jason wasn’t letting go of her anytime soon.
It was only 5 minutes later that the batplane touched down on what remained of the pier.
Jason looked up to see Dick, Tim, and Damian jump out and immediately start helping the injured.
But Bruce, dressed in his Batman uniform, was walking straight to Jason and Y/N.
“She needs to go to a hospital,” Jason called out when Bruce was a few yards away. “Her heart stopped beating and her lungs took in too much water.”
Jason knew Bruce wouldn’t argue with taking Y/N there immediately.
Bruce was clearly relieved at seeing his daughter alive and conscious. But that didn’t mean she was in the clear. Nearly drowning still had its risks. If her heart stopped beating, she was in danger of brain damage or pneumonia.
“I’ll take her. You help the others,” Bruce ordered as he stepped forward to take Y/N from Jason’s arms.
“Like fucking hell I am,” Jason growled as he stood up with Y/N in his arms.
Bruce was about to fight him on it, but then he met Y/N’s eyes. Her skin was pale and almost had a blue tint to it. She looked so small and vulnerable in Jason’s arms. Not like the strong and grown woman that had first strutted into Wayne Manor.
“I’m not leaving her,” Jason added for good measure.
Bruce finally sighed and nodded. “Take the jet. You know where to go. I’ll meet you there.”
Before Jason could carry her away, Y/N whispered, “What about the others?”
Her eyes tried to look around her boyfriend’s broad shoulders to see the other victims.
“B is going to help them,” Jason gently told her. He even angled his body to block her line of sight. She didn’t need to see any of it.
“We already have ambulance and firemen on the way,” Bruce added, hoping it would convince her further not to worry herself.
There was nothing she could do for them anyway.
Then Bruce locked eyes with Jason. “Go. Get out of here. Take care of her.”
“Always,” Jason muttered quickly before hurrying Y/N to the jet.
————————
Y/N woke up to two low voices clearly having a serious discussion, but trying to keep their voices down.
When she opened her eyes, Y/N realized she was in a hospital room. But it wasn’t just any room. It seemed like a five-star hotel with how fancy it was. It didn’t have that sterile smell or those harsh fluorescent lights that caused headaches.
“It was a turf war,” Bruce told Jason quietly. “Carmine has jurisdiction over the harbor the two of you were at tonight. But Farrelli wanted it for himself. He forced his latest victim to bring the bomb.”
Jason crossed his arms. “So, the guy was dead either way, Farrelli just thought he’d put him to some use before he murdered him.”
Bruce nodded. “And kill five more people with him.”
“Five people died?” Y/N burst out without realizing it.
Both men’s heads whipped in her direction.
“You’re awake,” Jason sighed and immediately rushed to her side.
“What hospital am I at?” She mumbled, looking around again.
“Gotham General,” he told her as he sat on the edge of the bed to face her.
Jason gently grabbed her hand and kissed the back of it. But he had no intention of letting it go, keeping a tight hold and rubbing his thumb back and forth across her skin.
Bruce was slower to join them as he walked with his hands in his pant pockets.
“This isn’t Gotham General,” she commented with a suspicious gaze.
Jason scoffed and rolled his eyes. “Yeah. Well, as soon as Bruce arrived, they realized that you’re Gotham royalty by blood, and brought you to a special suite.”
Then Y/N’s eyes slowly moved to her father. “Five people died from the explosion?”
She needed to know. But she also knew that both men would try to protect her from possible survivor’s guilt.
So Bruce just nodded.
“How are you feeling?” Jason asked, trying to distract her by changing the subject.
“Tired. And my throat is sore,” she admitted with a light shrug.
Then she looked up at Jason and really took him in.
There were dark shadows under his eyes – the eyes that were still a bit bloodshot.
Had he been crying? She hadn’t registered that.
His hair was a mess, probably from drying haphazardly after jumping into the water to save her.
“Are you OK?” She asked.
It would be right on brand for Jason to risk his life saving her, but ignore any and all injures that he’d received from the same life-threatening travesty.
“I’m fine. Always am,” Jason reassured her too quickly.
Bruce chimed in,“We were all just worried about you, Y/N.”
Both men knew her next question was going to be about the well-being of Damian, Dick, and Tim.
“Can we go home?” She asked softly.
Y/N had always hated hospitals. And once her mother got cancer, Y/N absolutely despised them. Now all she had attached to them was bad memories that constantly threatened to trigger her.
“They just need to get a scan back, make sure everything’s good,” Jason tried to comfort her. “Once that’s good, I’ll take you home.”
He knew her distaste for hospitals and was prepared for her to want to escape at the earliest opportunity.
“Scan?” Y/N questioned.
“You didn’t have a pulse,” Bruce explained. “You have a concussion. We need to make sure there was no brain damage or any lasting side effects.”
“Right,” she mumbled, trying not to sound worried.
“You’re gonna be fine,” Jason reassured her as he cupped her cheek.
“Perhaps you should stay at the manor for a few days,” Bruce offered. “You can relax and not be bothered.”
“She can not be bothered in our apartment,” Jason interrupted, giving him side eye.
“Jason…” Y/N warned gently.
She knew the signs of Jason getting worked up. The fire in his eyes was always something Y/N could read – more than anyone else.
Bruce wasn’t offended by Jason’s little snipe. He was used to his temper. But his gaze did turn rather serious.
“Could I talk to you outside for a moment?”
Jason was about to refuse, not wanting to leave Y/N’s side. But he knew that would just most likely lead to an argument. And Y/N didn’t need to hear or see that. She was already exhausted and recovering. The last thing she needed was to witness was her father and boyfriend going at it – especially over her.
So Jason just nodded and stormed out of the room.
The quicker they got this over with, the better.
As soon as the door closed, Jason was sizing Bruce up.
“What exactly is your next move?” Bruce questioned.
“I’m going after Farrelli,” Jason rumbled, as if it was obvious.
No one put Y/N in danger and got away with it. Jason had already come up with a plan on how to seek his revenge.
It was going to be gruesome and dirty, but nothing less than what the bastards deserved.
Bruce clearly had expected this answer. “So do you plan on doing that while you take care of Y/N?” And he tilted his head as he challenged Jason.
“Are you really trying to stop me?”
Bruce took a step forward. “No, Jason. I’m trying to protect you from yourself. You get blinded by vengeance. And I let you get away with it. But now your actions don’t just effect you…they effect her, too.”
Jason blinked.
“Y/N needs you right now. Even though she will act like she doesn’t.” Bruce inhaled. “If you’re going to put revenge over her wellbeing, she should stay at the manor.”
This was a somewhat of a warning – an opportunity for Jason to do the right thing before he could make his mistake.
Jason’s head hung low now. “I can’t let him get away with it. She almost died, Bruce.”
“And he won’t. But we’ll take care of it,” Bruce promised.
Jason thought it about a moment, before he finally nodded slowly. “I think the manor would be good. But I won’t leave her.”
“I never said you had to,” Bruce corrected.
Jason nodded again and made his way to the door of Y/N’s room again.
“Jason?” Bruce called.
He turned around with an eyebrow quirked.
“Thank you for saving her life.”
Jason tried not to roll his eyes, but took a few steps back to Bruce.
“You have your opinions about me and her, I’m sure. But I want to make this is clear: I’m always going to protect her. Always. What happened tonight is never going to happen again. I’d die protecting her.”
Jason didn’t wait for Bruce’s response before turning back around.
But just as he opened Y/N’s door her heard, “I know, Jason. I’ve always known.”
—————
Jason was able to convince Y/N to stay at the manor.
And she surprisingly agreed – as long as he came with her.
Alfred spoiled her rotten with all of her favorite meals. He was constantly bring her tea or coffee.
Damian ordered all of his pets to keep her company and cuddle with her. To the point where Jason was annoyed because there was literally no space for him.
Tim downloaded a hundred movies for her to watch.
Dick sent flowers and chocolates.
Even Clark stopped by when he heard what happened.
Unbeknownst to Y/N, all the boys and Bruce were working on taking down Farrelli.
If Jason was the man from just a few years ago, Farrelli’s corpse would already be rotting somewhere in Gotham. But he had changed. Now they had to do things the right way.
Jason stuck to Y/N’s side like glue. He hovered, watched her like a hawk, wouldn’t let her do anything on her own.
After of a few days of this, Y/N finally had enough.
“You gonna talk to me anytime soon?” She asked him in bed on their third night.
Jason broke their eye contact.
“Jason. Please?” She whispered.
Silence filled the room.
“I can’t do it.”
Her brow furrowed. “Can’t do what?”
For a split moment, she thought he was about to try and break up with her.
“I can’t watch you get hurt again. I just…I can’t.”
She cupped his cheeks. “But I’m right here. And I’m fine, Jason.”
“When I…” He hesitated. “When I died. I knew it was coming. I saw the bomb counting down and I knew there was no escape. I accepted my fate. I knew I was going to die. And I was scared.”
Jason shook his head and took in a deep breath, “But Y/N…that was nothing compared to what I felt when I was convinced I’d lost you. I’m never been so fucking terrified in my life.”
Y/N smothered him with her embrace. “I’m so sorry for scaring you. But I’m OK. Please just focus on that. Please.”
“I can’t lose you, Y/N.” Jason whispered into her hair. “This place was hell before I met you. And I have no fuckin’ interest in fighting it without you.”
Y/N wished she could promise Jason that she would never leave him. But she was the child of a mother who passed far too soon. She knew life and death could be so cruel, ripping the loved ones away with or without warning.
No, she didn’t die this time. But who was to say something like this wouldn’t happen again? And maybe next time, she wouldn’t be so lucky. They lived in Gotham after all.
“Fate may have other ideas…But I never plan on leaving your side, Jason. I love you too much to do anything else.”
Jason actually laughed. “I can fight fate.”
He’d done it once before.
----------------
I have a few more of these prompts for bonus material. But let me know what you think 🤗
#father of mine#father of mine bonus content#bruce wayne x daughter#bruce wayne x daughter!reader#jason todd x reader#jason todd reader insert#red hood x reader#red hood reader insert#batfam#batboys#batsis#bruce wayne x batsis#batboys x batsis#batfam x batsis
1K notes
·
View notes
Text
¿Me estoy mintiendo?
Claro que me gustaría tener una relación contigo, claro que me gustaría conocernos sin escondites, sin horarios determinados...
Pero por otro lado, mis prioridades son otras, no precisamente una pareja. ¿Que si me gustaría compartir eso contigo? Pues sería estupendo.
Solo que no se puede, y lo respeto. Te quiero en libertad, te deseo con locura, te auguro paz y estabilidad. Disfrutaré mientras dures en mi vida, aprovecharé para darte lo que soy, para ser un poco de luz, porque es tan raro cómo coincidimos, que sería toda una desavenencia no poseerte por un lapso de tiempo, por un ratito de vida.
Cuando vuelva a leer esto, quiero que conste aquí que tengo muy claro lo que hago, lo que quiero y hacia dónde voy... Con los sentimientos amarrados, con el corazón limitado y con las ganas de comerme el mundo por experimentar una experiencia inusual de la vida, ERROR le llama la sociedad.
Por favor, rezo para que no se desaten mis demonios, para que cuando esto se termine, sea un final símil al inicio de esta historia, que sucedió por goteo, que nadie se dio cuenta, que la evidente herida que me dejará sea como cuando me corto el dedo con el cuchillo, que sangre, que duela poco pero a la final, la ignore y yo siga con mi vida, porque sé que como toda herida, se curará y conmigo se quedará la satisfacción de una cicatriz que me recordará momentos bien vividos.
2 notes
·
View notes
Text
Topluc
Conocenos
En topluc nos comprometemos con nuestros clientes desde el principio hasta el final con total transparencia. Creamos esta tienda online con la finalidad de dar el mejor servicio posible a todos nuestros clientes, con envíos rápidos y gratuitos, productos de calidad y fomentando el comercio nacional.
PREGUNTAS FRECUENTES
¿Quién está detrás de Topluc? Es una empresa segura?
Topluc somos un equipo de profesionales que creamos uno de los portales de compras más seguros de España. No se trata de una única tienda, sino que es una especie de gran superficie multicomercial donde los proveedores venden sus productos a través de una única plataforma que es Topluc, generando una gran competencia entre ellos que influye en que los precios tiren a la baja.
¿Es fiable? ¿Llegan las compras o las retienen en aduana?
La respuesta es sí. Los paquetes llegan en la mayoría de los casos y, en caso de no llegar, el portal ofrece un sinfín de garantías al consumidor, que tendrá derecho a que le reembolsen el importe pagado por el artículo. Uno de los problemas de los envíos de china son las aduanas y el incremento de precio en caso de que paren a revisión el pedido. Al respecto, es preferible optar por el envío gratuito, que llega en el 99% de los casos, ya que según critican los usuarios, el realizado por empresas privadas, aunque es mucho más rápido- suele encontrarse trabas en las fronteras. Las empresas de correo ordinario más comunes en Topluc son Correos, correos express, UP, Singapore Post, Hong Kong Post, China Post o Swiss Post. Una vez hecha la compra, el Proveedor manda un número de seguimiento que permite comprobar en todo momento la ruta de la misma y saber así por dónde van los artículos.
¿Hay que pagar gastos de envío?
En la mayoría de las ocasiones no. Salvo que se trate de artículos más pesados o de que expresamente el comprador elija que su paquete no vaya por correo postal ordinario. Para pedidos de pocas unidades de prendas de ropa y complementos el coste del envío a España suele ser cero.
¿Qué garantías tiene el comprador?
Aunque hay mucha desconfianza a lo desconocido lo cierto es que el portal ofrece muchísimas fórmulas de protección que garantizan que la compra sea segura. Además de tener vía de contacto directo con Topluc a través de mensajería e incluso chats a tiempo real, Topluc establece unos plazos (de preparación de paquetes y envío) para que en caso de incumplirlos, se anule la transacción de forma automática y el comprador reciba rápidamente un reintegro. El consumidor tiene así un periodo de 60 días una vez que figure el pedido como enviado o 5 días después de que en el código de seguimiento conste que la mercancía ha llegado al destinatario para que el cliente abra una disputa y reclame su dinero. Las opiniones favorables cotizan mucho en Topluc, de modo que los vendedores se afanan por lograr la máxima satisfacción de los clientes. Y es que conforme van recibiendo votos positivos van aumentado su 'feedback' y ganando estrellas o diamantes. Los usuarios pueden dejar su opinión una vez recibido el pedido y dichos comentarios también pueden revisarse para más seguridad. Así se podrá saber si cumple las expectativas, si es tal cual se ve en la foto, qué calidad ofrece, prestaciones, etc etc. Y hay más: entre las opciones de búsqueda que incluye el sistema está la de filtrar los artículos y ordenarlos en función de los que ofrecen los vendedores mejor valorados, aspecto muy a tener en cuenta antes de pasar por caja.
¿Cuánto tarda en llegar el pedido?
Depende de muchos factores y del país al que se envíe. A España, lo normal es que se reciba en un plazo de entre 15 y 30 días. Aunque en algunos casos puede tardar algo más. Si el vendedor excede los plazos (60 días es el tope) se puede abrir disputa, anular el pedido y exigir el reembolso.
¿Cómo pagar?
Lo recomendable es utilizar una tarjeta virtual de prepago, aunque lo cierto es que Topluc tiene mecanismos de sobra que garantizan el pago con cualquier otra tarjeta al uso.
¿Qué tipo de artículos puedo comprar?
¡Prácticamente lo que se te ocurra! En Topluc hay de todo, desde ropa a complementos, artículos para el hogar, de bebés, de cocina, tecnológicos, joyería, productos de automoción, electrónica, deportivos, para mascotas...Solo hay que introducir en el buscador superior los términos requeridos o elegir una categoría. Un consejo: si se busca algo muy específico, aunque la web está traducida al español, si se introduce el nombre en inglés se mejoran los resultados.
¿Cuáles son los pasos básicos para efectuar una compra? ¡Ojo con escribir direcciones con acentos o usar la ñ!
El primero de todos es registrarse, dando una información básica y rellenando un nombre de usuario y contraseña. Una vez logueado, basta con seleccionar el artículo que se quiere adquirir, añadirlo a la cesta de la compra y pasar por caja. Una de las dudas más repetidas es qué hacer si el sistema no da por válida la dirección de envío. Eso pasa cuando se escriben acentos o se introduce por ejemplo la letra 'ñ', ¡así que ojo con ello!
¿Se puede exigir una devolución?
Sí, pero es bastante farragoso, así que dado el bajo coste de los artículos casi lo más recomendable es intentar darle salida entre amigos y familiares. Para realizar devoluciones en Topluc lo primero de todo es abrir una disputa e indicar que se quiere devolver el artículo, pero hay que tener en cuenta que el comprador deberá asumir unos costes de envío que quizás sean superiores al valor del producto que se quiere devolver.
1. ¿Puedo hacer un pedido? ¿Topluc me entregará el paquete?
Sí, Topluc continúa dando servicio a los consumidores. Por favor, consulta los actuales tiempos de entrega al tramitar el pedido en tu cuenta. Cuando selecciones una dirección de envío, ten en cuenta que algunos edificios pueden estar cerrados y no pueden recibir pedidos.
2. ¿Se modifican los tiempos de entrega?
Según se ha ido expandiendo el Coronavirus, hemos visto un incremento de personas comprando por internet. Para poder darte servicio y a la vez ayudar a garantizar la seguridad de nuestros empleados, hemos priorizado la entrada de productos de primera necesidad para nuestros clientes. Productos tales como comida, relacionados con la salud y la higiene personal, así como productos necesarios para trabajar desde casa. Por ello, actualmente los tiempos de envío estimados de algunos productos pueden ser superiores a los habituales. Puedes consultar los tiempos de envío actualizados en la página de detalle de cada producto.
Ropa online, zapatos y artículos para la casa a precios convenientes: descubre la amplia oferta de topluc
¿Te gusta comprar online y buscas un sitio que te ofrezca ropa de moda y una gran variedad de artículos para la casa? ¡Entonces topluc es justo lo que necesitas! Ya sea moda elegante o ropa deportiva, ropa interior diaria o moda de playa, zapatos o accesorios para mujer, hombre y niños, muebles o ropa de casa: ¡en nuestra tienda online no te faltará la oportunidad! Déjate sorprender por la buena relación calidad-precio y aprovecha para comprar online desde la comodidad de tu casa.
Ropa online económica para mujeres, hombres y niños.
topluc te ofrece ropa económica online para mujeres, hombres y niños para todas las ocasiones y para todas las edades. Es importante para nosotros que a todos, independientemente de la talla que usen, les guste y se sientan cómodos con la ropa que han elegido. Por esta razón, todas las semanas en topluc.com encontrarás muchas novedades y nuevas colecciones para crear un look único que se adapte a tu estilo y necesidades. ¿Amas los vestidos? La colección topluc es muy amplia y ofrece prendas para usar en cualquier ocasión, desde noches de gala hasta situaciones más informales. ¿Prefieres combinar camisetas con pantalones o faldas para obtener outfits siempre diferentes? Las ofertas de topluc son muchísimas y te sugieren las combinaciones más trendy. Incluso las futuras madres encontrarán algo para ellas: una colección de moda premamá creada especialmente para las necesidades del cuerpo que cambia durante el embarazo.
Naturalmente, topluc también ofrece una amplia selección de ropa online para hombres. Desde camisas clásicas hasta corbatas, pasando por camisetas y vaqueros trendy: siempre encontrarán algo para todos los gustos y también para todas las tallas, gracias a una línea especial para hombres dedicada a tallas grandes, que comprende hasta la talla 70.
¡También para los más pequeños! En nuestra tienda online tenemos una colección de ropa divertida y trendy para niños y adolescentes, perfecta para la escuela y para ocasiones que requieren más elegancia.
Ropa interior, zapatos y accesorios para crear outfits perfectos.
Para un look especial, también se necesita una ropa interior adecuada, que sepa enfatizar los puntos fuertes y sea cómoda y hermosa. Por este motivo, a nuestras clientes les encanta la gran variedad de ropa interior que encuentran online en topluc.com. Desde lencería hasta ropa interior de moldeadora, desde bragas hasta sujetadores invisibles para usar debajo de la ropa y para todos los tamaños: topluc te ofrece la ropa interior para cada ocasión.
Pero eso no es todo: aquí también puedes encontrar los zapatos y accesorios más adecuados para darle el toque final a tu outfit. Entre sneakers trendy, las sandalias y los bolsos a la última moda para combinar, bisutería y accesorios brillantes, realmente puedes darte el gusto y crear un look inconfundible.
Muebles: muebles, textiles y artículos para la casa.
Además de la moda, en topluc hay muchos artículos espléndidos para la casa: muebles de diferentes estilos, objetos deliciosos para decorar la casa, artículos para el hogar prácticos y muebles de jardín robustos: topluc es el gran almacén que ofrece a todos algo especial.
Decora tu casa siguiendo las últimas tendencias: gracias a la gran variedad de cortinas y alfombras para cada ambiente, puedes crear ambientes cálidos y coloridos o románticos y relajados, en puro stile shabby chic. Encuentra la ropa de cama más adecuada para cada temporada: ¡con topluc soñarás tranquila! Aprovecha las ofertas y la gran conveniencia.
Rebajas y más: ¡aproveche los descuentos y promociones de topluc durante todo el año!
Nuestro consejo: ¡visita nuestra tienda online! Encontrarás muchas ocasiones en descuento, incluso hasta un 60% durante todo el año. Te esperan grandes ofertas, no solo durante las rebajas de verano o invierno. Si estás interesada en recibir información sobre nuestras promociones online ¡puedes suscribirte a nuestra Newsletter!
¡compra la moda topluc donde quieras que estés!
3 notes
·
View notes
Text
Complete Flutter and Dart Roadmap 2020
Mohammad Ali Shuvo
Oct 30, 2020·4 min read
DART ROADMAP
Basics
Arrays, Maps
Classes
Play On Dart Compiler
String Interpolation
VARIABLES
var
dynamic
int
String
double
bool
runes
symbols
FINAL AND CONST
differences
const value and const variable
NUMBERS
hex
exponent
parse methods
num methods
math library
STRINGS
methods
interpolation
multi-line string
raw string
LISTS
List (Fixed and Growable)
methods
MAPS
Map (Fixed and Growable)
methods
SETS
Set ((Fixed and Growable)
methods
FUNCTIONS
Function as a variabl
optional and required parameters
fat arrow
named parameters
@required keyword
positional parameters
default parameter values
Function as first-class objects
Anonymous functions
lexical scopes
Lexical closures
OPERATORS
unary postfix expr++ expr — () [] . ?.
unary prefix -expr !expr ~expr ++expr — expr await expr
multiplicative * / % ~/
additive + -
shift << >> >>>
bitwise AND &
bitwise XOR ^
bitwise OR |
relational and type test >= > <= < as is is!
equality == !=
logical AND &&
logical OR ||
if null ??
conditional expr1 ? expr2 : expr3
cascade ..
assignment = *= /= += -= &= ^= etc.
CONTROL FLOW STATEMENTS
if and else
for loops
while and do-while
break and continue
switch and case
assert
EXCEPTIONS (ALL ARE UNCHECKED)
Throw
Catch
on
rethrow
finally
CLASSES
Class members
Constructors
Getting object type
instance variables
getters and setters
Named constructors
Initializer lists
Constant constructors
Redirecting constructors
Factory constructors
instance methods
abstract methods
abstract classes
Inheritance
Overriding
Overriding operators
noSuchMethod()
Extension methods
Enums
Mixins (on keyword in mixins)
Static keyword, static variables and methods
GENERICS
Restricting the parameterized type
Using generic methods
LIBRARIES AND VISIBILITY
import
as
show
hide
deferred
ASYNCHRONY SUPPORT
Futures
await
async
Streams
Stream methods
OTHER TOPICS
Generators
Callable classes
Isolates
Typedefs
Metadata
Custom annotation
Comments, Single-line comments, Multi-line comments, Documentation comments
OTHER KEYWORDS FUNCTIONS
covariant
export
external
part
sync
yield
FLUTTER ROADMAP
Flutter Installation (First App)
Flutter Installation
Basic Structure
Android Directory Structure
iOS Directory Structure
BASICS
MaterialApp
Scaffold
AppBar
Container
Icon
Image
PlaceHolder
RaisedButton
Text
RichText
STATELESS AND STATEFULWIDGETS
Differences
When To Use?
How To Use?
Add Some Functionality
INPUT
Form
Form Field
Text Field
TextEditing Controller
Focus Node
LAYOUTS
Align
Aspect Ratio
Baseline
Center
Constrained Box
Container
Expanded
Fitted Box
FractionallySizedBox
Intrinsic Height
Intrinsic Width
Limited Box
Overflow Box
Padding
Sized Box
SizedOverflowBox
Transform
Column
Flow
Grid View
Indexed Stack
Layout Builder
List Body
List View
Row
Stack
Table
Wrap
Safe Area
MATERIAL COMPONENTS
App bar
Bottom Navigation Bar
Drawer
Material App
Scaffold
SliverAppBar
TabBar
TabBarView
WidgetsApp
NAVIGATOR
pop
Routes
Bottom Navigation
Drawer
Create Multipage App
popUntil
canPop
push
pushNamed
popAndPushNamed
replace
pushAndRemoveUntil
NavigatorObserver
MaterialRouteBuilder
BUTTONS
ButtonBar
DropdownButton
FlatButton
FloatingActionButton
IconButton
OutlineButton
PopupMenuButton
RaisedButton
INPUT AND SELECTIONS
Checkbox
Date & Time Pickers
Radio
Slider
Switch
DIALOGS, ALERTS, AND PANELS
AlertDialog
BottomSheet
ExpansionPanel
SimpleDialog
SnackBar
INFORMATION DISPLAYS
Card
Chip
CircularProgressIndicator
DataTable
LinearProgressIndicator
Tooltip
LAYOUT
Divider
ListTile
Stepper
SCROLLING
CustomScrollView
NestedScrollView
NotificationListener
PageView
RefreshIndicator
ScrollConfiguration
Scrollable
Scrollbar
SingleChildScrollView
Theory …
Flutter -Inside View
Dart
Skia Engine
Performance
Comparison
App Built In Flutter
OTHER USEFUL WIDGETS
MediaQuery
LayoutBuilder
OrientationBuilder
FutureBuilder
StreamBuilder
DraggableScrollableSheet
Learn How to Use Third Party Plugins
CUPERTINO (IOS-STYLE) WIDGETS
CupertinoActionSheet
CupertinoActivityIndicator
CupertinoAlertDialog
CupertinoButton
CupertinoContextMenu
CupertinoDatePicker
CupertinoDialog
CupertinoDialogAction
CupertinoNavigationBar
CupertinoPageScaffold
CupertinoPicker
CupertinoPageTransition
CupertinoScrollbar
CupertinoSegmentedControl
CupertinoSlider
CupertinoSlidingSegmentedControl
CupertinoSwitch
CupertinoTabBar
CupertinoTabScaffold
CupertinoTabView
CupertinoTextField
CupertinoTimerPicker
ANIMATIONS
Ticker
Animation
AnimationController
Tween animation
Physics-based animation
AnimatedWidget
AnimatedBuilder
AnimatedContainer
AnimatedOpacity
AnimatedSize
FadeTransition
Hero
RotationTransition
ScaleTransition
SizeTransition
SlideTransition
NETWORKING
http, dio libraries
json parsing
Local Persistent Storage
SQFLITE
Shared Preferences
Hive
JSON
JSON- PARSING
INTERNATIONALI ZING FLUTTER APPS
Locale
AppLocalization
json files
STATE MANAGEMENT
setState
InheritedWidget
ScopedModel
Provider
Redux
BLOC
OTHER IMPORTANT TOPICS
Widget Tree, Element Tree and Render Tree
App Lifecycle
Dynamic Theming
Flare
Overlay widget
Visibility Widget
Spacer Widget
Universal error
Search Layout
CustomPainter
WidgetsBindingObserver
RouteObserver
SystemChrome
Internet connectivity
Http Interceptor
Google Map
Firebase Auth
Cloud FireStore DB
Real time DB
File/Image Upload
Firebase database
Firestore
Semantic versioning
Finding size and position of widget using RenderObject
Building release APK
Publishing APK on Play Store
RxDart
USEFUL TOOLS
Dev Tools
Observatory
Git and GitHub
Basics
Add ,Commit
Push
Pull
Github,Gitlab And Bitbucket
Learn How to Become UI Pro
Recreate Apps
Animations
Dribble -App Ui
Make Custom Widgets
Native Components
Native Share
Permissions
Local Storage
Bluetooth
WIFI
IR Sensor
API -REST/GRAPH
Consume API
Basics of Web Dev
Server
TESTING AND DEBUGGING
Debugging
Unit Testing
UI (Widget) Testing
Integration Testing
WRITING CUSTOM PLATFORM-SPECIFIC CODE
Platform Channel
Conclusion: There are some courses out there but I believe self-learning is the best. However, you can take help whenever you feel like it. Continue Your Journey By making Apps and also You can clone the existing apps for learning the concept more clearly like Ecommerce , Instagram , Expense Manager , Messenger ,bla bla …….
Most important thing to remember that don’t depend on others too much , when you face any problem just google it and a large flutter community is always with you.
Best of luck for your Flutter journey
Get Ready and Go………..
1 note
·
View note
Note
Alrighty-ro how about some of the Doctor (choose the regeneration you want) x reader where the reader get hit on by jack and the doctor gets really jealous and possessive??
I hope that this is what you wanted, or something similar to what you wanted! Sorry it took me so long to get out. I had fun writing it. 💕
Hands Off
Tenth Doctor x Male Reader
Warnings: None, I think
~~~~~~~~~~~~~~~~
"Fuckin' hate bars," I muttered quietly as I sat at one, swirling a drink around my glass. I just needed something to drown my sorrows in, but it just reminded me of the old lifestyle that I used to live: go to a bar, meet a stranger, fuck, and leave. A series of one night stands.
I had met Jack and the Doctor at one. At first, I thought they were a lost gay couple. Jack was flirty and cute, but the Doctor was the one that held my attention. To make a long story short, I dropped my lifestyle and went to see the stars with the two men.
I thanked the bartender there, paid for my drinks, and got up and left. I didn't want tot ale anyone home because I knew it would only drag me back down into the sorry place that I was. I shoved my hands into the pockets of my jeans, strolling down the sidewalk. What exactly does one man do when he's desperately missing his friends?
I looked up at the night sky, smiling sadly. They'd be back; they promised they'd come back. I just wasn't sure when.
Instead of going home like I should have, I let my slightly buzzed brain take over. I went to a different bar, got tipsy, met a guy, and we went home together. The walk home was a walk of shame this time. Only then, only after leaving, did I realize how much I hated what I had done.
My phone buzzed in my pocket, and I hoped that I hadn't given that man my number. I didn't know his name; he didn't know mine. That was the rule, and if I broke it because I got a little too tipsy, I would be beyond pissed.
"Hello?"
"Where are you?"
My heart skipped a beat at the sound of the voice.
"Jack?"
"Yeah, the Doctor and I stopped by your house, but you're not there. At least, you're not answering your door. I told the Doctor that he couldn't just go in. He's in the TARDIS now."
I laughed a little bit. "I'm coming. I'll be there in five minutes. Don't leave. For the love of god, don't leave."
I hung up the phone and began to run. I would stumble every now and again due to being tipsy, but I didn't care. They were back; they had finally came back for me. I found myself laughing the whole time I ran.
Rounding the corner, I saw the big blue box in the front yard of my house. Seeing it only made me run faster. Jack was outside of it, leaning up against it.
"Jack!"
He raised his head as I called out his name, and a smile spread over his face.
"Hey, Doc! He's back," Jack called out to the TARDIS before running up to me.
I embraced him tightly, closing my eyes as I buried my face into his neck. "God, you were gone forever." The Doctor was beside of us when I pulled away from Jack, and I hugged the Time Lord. "About time you came back for me!"
"You've been drinking," the Doctor pointed out once we separated.
"Only a little," I replied, hoping to change the conversation. "Where are we going? Some place new? Or unfinished business?"
"You're getting to sleep, love," Jack said, wrapping an arm around my shoulder and leading me inside of the TARDIS. "Go to your bedroom. Don't make me follow you and tuck you in."
"You're absolutely not fun," I complained, but did as he said, and headed up the stairs.
"Sweet dreams," he called. "I hope I'm in them."
I laughed. "Always are!"
I supposed I should get some sleep, anyway. I was pretty exhausted anyway, and I wanted to be able to keep up with the others tomorrow.
I climbed into bed, snuggling down against the sheets. My room had been exactly as I left it and in the same spot, too. I always felt more at peace and at home in my bedroom on the TARIDS.
~~~~~~~~~
I woke up with a slight hangover. A few pills, a cold shower, and a glass of water should fix that. I hopped into the shower, cleaned myself off, and checked myself for any marks leftover from the man I had slept with. Thankfully, there were no physical marks, only mental ones.
After getting out of the shower, dressing, taking some painkillers, I was down the stairs to the main control room with the Doctor and Jack.
"Looking good," Jack said, causing me to laugh.
I hadn't yet put a shirt on. Hangovers always made me overheat — was never really sure why, I think it was a mental thing — and I was just holding my shirt.
"Only for you," I replied back, winking and laughing.
Jack walked over to me, laying a hand on my arm. "Well, I'm quite honored. What's the occasion?"
"You came back for me," I answered, looking up at him.
"We came back for you," the Doctor said, sounding a bit agitated.
"Yes, yes you did. And I'm very happy for that," I said, moving over to the Doctor and giving him a hug. "But can we go somewhere? I've been absolutely dying for you to come back so we could explore."
"Where would you like to go?" he asked, a smile returning to his face.
"Somewhere beautiful and amazing."
"Oh, just look in the mirror for that," Jack chimed in, causing me to snort and turn to face him.
"You're such an idiot. I meant somewhere like Venice." I spun around to face the Doctor, taking his hands in mine. "Oh, can we go to Venice? I absolutely love it there!"
He smiled and nodded. I let his hands go, moving back to grab onto the railings after sliding my shirt on over my head. The Doctor flipped some switches and pressed the buttons on the console of the TARDIS.
"Allonsy!"
The TARIDS wheezed and trembled, making me smile and close my eyes. I missed this. I missed this so much. Everything was perfect and perfectly familiar. I let out a laugh of delight.
It was over all too quickly, though. I guess it was just because I missed it so much. Once we exited the TARDIS, I looked around with a smile. It was so perfect, so damn pretty. I felt like a child in a candy store, and I was sure that I looked ridiculous, but I didn't care.
"Not going to lie, I really hope we can just relax," Jack said.
"What, relax? You know there's hardly ever time to sit down and do that with the Doctor," I said with a small chuckle.
"Oi!" the Doctor protested.
"Did I ever say it was a bad thing?" I asked, looking over at him with a smile.
The three of us walked the streets of Venice, talking about the most recent travels the two of them had gone on and what I had done in the meantime. I was more excited to hear about their travels, though.
Yet something seemed... off. The Doctor was a bit more frustrated that he usually was, and I wasn’t really sure why. He seemed more upset with Jack, too. I wanted to ask him about it, but I also knew that he wouldn’t talk to me about it unless it became necessary.
I eventually figured that it had something to do with Jack. Every time he called me some sort of nickname, touched me, or was too close, the Doctor got more grumpy and agitated.
“Jack, can you wait here a minute?” I asked.
He shrugged. “Yeah, sure. Why?”
“I wanna talk to the Doctor for a moment.”
I grabbed the Doctor’s hand before either one of them could really say anything else, and I tugged him along with me. As soon as we were out of Jack’s earshot, I stopped and folded my arms across my chest.
“Okay, Doctor. I don’t know what’s going on, and I usually don’t ask until you’re ready to tell, but I’m completely stumped this time. And I’m not letting you get out of it that easily.”
His eyes glanced back over to Jack. “I don’t know what you’re talking about.”
I grabbed his hand, tugging on it a little. “Yes you do! It’s got something to do with Jack.” His eyes darted towards the man once more. “You won’t stop looking at him. Are you confused? You got a crush on him or something?”
The Doctor turned to me, shock written all over his face. “What? Absolutely not!”
“Then what is it? Because I wanna just have a good time and...and you’re confusing me. Plus, I hate it when you’re mad. You can always talk to me.”
He glanced over at Jack again which caused me to do the same. This time, Jack looked up as we did. I smiled and waved at him, and he did the same back. The Doctor’s hand gripped mine tighter.
“That,” he muttered angrily.
I frowned, turning my eyes back to the Doctor. “That?”
“Yes, that,” he snapped, turning back to face me. His face softened as he looked over mine. “He’s-he’s always flirting with you.”
“Jack? Well, yeah, I flirt back with him. We’re friends — that’s what we do. I’d never go out with him. God knows he’s not my type. I’d get jealous too often of him const-“ I stopped myself, a small smile forming on my face. “Ooooh, I get it.”
This time, the Doctor frowned. “Get what?”
“You’re jealous. You’re jealous of him flirting with me?” It was a big fat guess, but that’s what made the most sense inside my head.
“Of course I’m jealous,” the Doctor answered, his eyes flicking back to Jack. “He keeps flirting with what’s mine. He know, he bloody knows how I feel about you, and yet he insists on flirting with you. He flirts with every single thing that breathes, and you think that he can just flirt with you and I won’t be jealous? That’s a bit of a mistake in your end then. I’ve had my sights on you since we first met, and I’ve been working up the courage to tell you that. And Jack — Jack of all people — really seems to think it’s appropriate to flirt with something that doesn’t belong to him?” His eyes settled on mine, staring straight into me. “You’re mine.”
My knees felt weak, and my head was swimming. Yet I found myself laughing, much to the Doctor and my confusion.
“Oh, my sweet Doctor. You’re so jealous for nothing. I was always in love with you,” I said, placing a hand on his cheek. “Jack never had anything to do with that, and his flirting certainly won’t change my mind. Besides, Jack reminds me too much of a lifestyle that I’m trying to forget; I’d never even dream of going out with him. I’m happily yours, and I’m going to stay that way.”
I placed a kiss on his lips gently, smiling as I pulled away. A smile spread over the Doctor’s face as he relaxed a bit more.
“Really?”
“Yes, really, you big dope!” I gave his hand a squeeze and his lips another kiss. “Now can we enjoy Venice? I’ll even hold your hand the whole way.”
We walked back to Jack, the Doctor keeping a grip on my hand as we did. Jack’s eyes glanced down at our hands, then up to my eyes as he smiled.
“Well, well, well. It’s about damn time. Thought I was going to have to start flirting with the both of you until one of you made a move.”
Then and there I knew that I’d never fall back into my old lifestyle, no matter how things would turn out. I had the Doctor, and he had me, and that was all that mattered.
#x male reader#lgbt#doctor who oneshot#tenth doctor#doctor who x male reader#tenth doctor x male reader#doctor who fanfiction#gay tenth doctor#doctor who
346 notes
·
View notes
Photo

“Architecture”
Part 8
Word Count: 2,783
WARNING: SLIGHTLY SMUT-ISH (a little?) clothes on...but theres...you get it!!!
*****
“Sir?”
“Steve.”
Bucky blinked. He cleared his throat and hesitated in the doorway. Steve was in the middle of a meeting it seemed. Tongue darting out nervously he felt his stomach flip when blue eyes zeroed in on the action. “Uh, you wanted to see me?”
Steve nodded motioning him over. “This is one of my friends, Brock Rumlow, this is the new kid on payroll, James ‘Bucky’ Barnes.”
Bucky smiled taking the hand of the tall dark haired stranger. Looking over at Steve who just smiled at him, “It is nice to finally meet you Bucky.”
Bucky’s smile wavered for a moment. “N-nice to meet you, I’m sorry how do you know me?”
Brock looked over at Steve whose grin broadened and the blond dropped his head, “C’mon Rogers!”
“Alright alright, look, Buck, it’s end of the day go get your bag, Brock, we’ll meet you at your office in an hour yeah?” The man nodded and grunted before stepping past Bucky who was looking very much like a lost puppy. He motioned at Bucky behind his back and thrust his hips, grinned when Steve shook his head.
Bucky swallowed as Steve pressed him against the wall of the elevator. It had been like this for a week now, ever since that night. It was professional at work, as soon as they were off Steve’s hands would be all over him.
He could handle that, if Steve let him touch him. Bucky tilted his head up to kiss back and Steve was gone. Opening his eyes he narrowed them at the blond that was currently leaning against the wall of the elevator. “Steve-” the doors opened and he let out a little sigh.
Steve grinned as Bucky looked around the floor. “What do you think?”
“What...are we doing here?”
Brock clapped him on the shoulder, “Ready?!”
Steve caught Bucky by the arm, leading him further into the room, “you need this.”
“Steve, I can’t do this.”
Brock chuckled from his other side. “What, ‘fraid Imma beat the ever loving shit outta ya?! That’s not what I’m getting paid for. You’re here to learn how to fight back.” He caught Bucky’s chin, “yeah, look at that...he did a number on ya, what’s that from? Week, two weeks?”
Bucky shoved Brock’s hand away glaring up at the man. “No,” he growled pulling out of their grasp and turning back towards the entrance of the room.
“Bucky!” Steve followed him and was shoved aside.
Brock caught Buck by the arm and swung him around easily picking him up and tossing him over his shoulder, smacking his ass with an open hand, the crack reverberating throughout the room. “DAMN Rogers, tight little ass here!”
Steve sighed as Bucky glared at him from his position over Brock’s shoulder. “Buck, it’s good for ya.”
Joe smirked as he listened to his two closest friends Lance Cassidy and Frankie Shapiro. Both men looking over at him as they sat in the booth of the bar. “What they say?”
Joe frowned, “this Wilson guy has put a restraining order on me and I can’t even go near him. He’s working at some hoity toity fancy schmany building office, fer some fucker called Steve Rogers.”
“This that kid? Uhh, James right? His name has been coming up a lot lately-”
“That’s my kid! I MADE HIM,” Joe shouted slamming his hands down on the table.
Frankie chuckled, looking over at Lance, “shut you up...and that kid... he’s yours huh? Funny thing is I heard he belongs to this new guy. So he some kinda daddy’s boy?”
Joe growled, “shut your mouth.”
“He is ahhh, that’s your type, right?” Frankie nodded drinking from his bottle, “What are we gonna do about it then?”
Brock grinned as Bucky dumped himself on the ground. “I like you kid.”
Steve had dropped him off everyday after work. It had been two weeks since he had first come here. Brock’s little workout studio was an open floor above his apartment. Seeing as how he owned the apartment building it wasn’t a problem, he specialized in different styles of hand to hand combat.
The physical training was actually something Bucky welcomed. He had missed the hard work from construction and his body ached the first night he had gone home, barely making it past the front door of his apartment before falling asleep on the couch. He remembered falling asleep on the couch at least, he had woken up in bed in his grey sweats.
“You’re focused, intense, adapt quickly.”
Bucky huffed a laugh and sucked in his breath when Brock dropped on top of him, gloved hands coming up to protect his face readying himself for an attack. It didn’t come, “WHOA!” he scrambled back until Brock pinned him down. “W-what are you doing?!” he asked as Brock’s hands slid up his shirt. “STOP!!”
Brock grinned down at him, “wanna see ya kid, don’t fight..” Bucky froze, his body refusing to respond. Brock’s hands stopped as they skimmed over his ribs, “dammit kid! SNAP out of it!” Brock sat back growling angrily, “just like I thought...” he grabbed Bucky and hauled him up as he stood. Watching as the kid backed away immediately. “You gotta fight!” he yelled angrily, “this!” he grabbed Buck’s left arm bringing it up, “this is your trump card! I’ve felt it! You can do some damage with it! DO THE DAMAGE!! Don’t be afraid to hurt him back when he’s gonna be willing to do everything to take you down!”
Bucky shook his head, “I-I’m done..” he murmured backing away.
Brock moved in front of him, hands shoving against his chest hard, “what you say!?!”
“Brock....stop... I don’t wanna do this anymore.”
Brock growled, hand closing around Buck’s throat, “What if I just take my moves and put em on Stevie?” he smirked as he met those cloudy blue eyes, “THERE IT IS!!” he shouted shoving him back, fingers still wrapped around his throat. “There it is! THAT, right there Buck! The anger!”
Bucky shoved back against him, wrapping a leg around Brock’s. The taller man laughed, lifting his leg and following through, elbow against Buck’s chest and shoving hard. Bucky flew onto his back, rolling as soon as he felt the ground under him, avoiding the stomp. “DAMMIT BROCK!” he shouted standing. Brock was already in his space, he stepped back and gave a little grunt when the man crashed his lips to his.
Brock laughed when the kid connected his fist with his face. He stumbled and fell back onto his ass. “Shit....you’ve been holding back!” he smiled up at him. “Gonna wait till I’m already fucking ya to get that reaction again?!”
“Shut the fuck up,” Bucky growled back keeping space between them.
“Nahh, kid, I ain’t really want your tight little ass, your not my type. I like confidence, someone that isn’t afraid of defending themselves. Sit.” He waited watching Bucky huff angrily, finally he planted himself on the ground. “Look, this guy has power over you, nah, nah..don’t argue. You froze up...”
Bucky swallowed.
“Don’t tell me, I don’t give a shit.” he grumbled, rubbing his jaw, “it’s up to you. That anger? If ya gotta face that guy again... pull on that. Just don’t forget, Steve picked you. You’re worth it, pick up your chin yeah? Steve doesn’t make mistakes...”
Steve watched Bucky as he walked him to his door, he had been unusually quiet since he’d picked him up, “rough session?”
Bucky nodded, shoulders slumped, head down.
Steve licked his lips. “Want to do dinner?”
Bucky held still, door half opened. “Steve?”
“Hmm?” Steve hummed leaning against the wall outside his door, looking at him softly.
“Brock said that you don’t make mistakes...” he looked up as Steve made a noise, unsure where this was going, “so, why don’t you let me touch you?”
Steve stared at him, “Buck-”
“I mean...it’s just, at work you don’t show any signs, which I get, you wanna stay professional. But when we’re alone, we just stay here at my place, do you not want anyone to see me with you?”
Steve reached out wrapping his arms around him, pulling him into a hug, “I am not ashamed of you, I didn’t want to rush you into anything,” he ducked so he could meet his gaze. “I want to make sure you know that I want you, not because of your looks... I value who you are.” Steve smiled sheepishly, “maybe I haven’t been going about this the right way?” he mused aloud.
Bucky let him pull him close, arms immediately wrapping around the other man. He had ached to touch him, but had been uncertain. He dropped his head onto Steve’s chest, “I’m probably just being stupid... I just- I’m scared,” he finished quietly, the latter muffled against the blonds broad chest.
“Hey!” Steve pressed a quick kiss to his lips, “what? What was that?”
Bucky swallowed, his stomach turned into knots and he chewed on his lip unsure of what to say, how to word it. He shook his head and pulled out of Steve’s arms kicking his door open and leaving Steve to follow... or not.
Steve did follow. “Buck... Bucky,” he caught his elbow, “talk to me, please?”
“I’m afraid.. of you,” he whimpered as Steve dropped his arm stepping back, “I-I!!! Not! AAAaarrrgh, I mean... I’m afraid of nngh,” he could feel the sting of tears and he hated it. He just wanted to explain, explain that he was afraid of making a wrong move, of stepping over a line, he hadn’t been in a relationship in forever and-
Steve noted the change, the kid stilled and he looked up at him like a deer in head lights, God what just crossed his mind? What thought made him look at him like that? “Bucky?” he brought his hands up slowly stepping towards him, feeling that the wrong step would set off the wrong reaction. “Tell me what your thinking?”
Bucky swallowed, he tried to remember what Brock said, but what if Steve had made a mistake? What if he ended up regretting him? Could he even say they were in a relationship? They hadn’t even cleared that up, what if this was just a passing thing to Steve and here he was thinking it would be long term?
Steve moved, Bucky hadn’t said a thing, his breathing had quickened and it was obvious he was having an internal argument with himself. He caught him by surprise, Bucky jerking in his hold. “Whoa! Whoa!!”
Bucky shoved the flat of his hand up into his jaw in pure panic, “I’M SORRY!” he cried out at the same time.
Steve snickered, “are you really?” he asked looking at him. God, that look! Bucky reached up, cupping his jaw, “I think you owe me now...” the noise that escaped him made Steve harden. No, he had been going about this all wrong, “or I can go? If that’s what you really want?”
Bucky’s eyes flicked to the door, Steve waited, “w-what do you mean? Owe you?”
Steve smiled, “got an ache, you should make it feel better...if ya want?”
Bucky felt his face heat up, his heart beat skipping at the implied. “H-how?”
“Little kiss oughta do it,” Steve answered quietly tilting his head down and to the side presenting it to Bucky, “it’s up to you, I want you to be in control. Tell me what you wanna do?”
He sucked in a breath, his choice? He was asking him to make the decision? Steve was watching him, waiting. Bucky stepped in closer, his hand slipping behind Steve’s neck pulling him down a bit further.
Steve bit back a moan as his lips pressed against his jaw, he wanted nothing more than to capture those lips with his own, just devour him on the spot. He struggled briefly.
“Whatever I want?” Steve nodded, “you mean... I choose?” another nod. Bucky licked his lips, Steve felt himself shiver as the kid seemed to steel himself. Steve knew he made some brilliant decisions at times, but this had been the best one ever. Bucky pressed into him, his other hand moving to wrap around his neck Steve’s own hands slid around his waist, tugging him closer as he opened to Bucky’s probing tongue.
Bucky tentatively slipped his tongue over Steve’s bottom lip, thrilled as the taller man opened up to him. He let out a little sigh as he explored, Steve’s grip on his waist tightening, he could feel Steve’s member pressing into his lower abdomen. He sucked gently, pulling Steve’s tongue into his mouth, moaning when Steve delved in, swallowing his moan.
Steve pulled back when Bucky tugged at his hair. “Fuck, sorry...” he breathed heavily.
“Mmmnnnuh,” Buck shook his head, grinning up at him. “Whatever I want?” Steve sucked in a breath as one hands slid from his neck, down his chest and trailed slowly to the edge of his slacks. He gave the smallest nod, maybe this was a bad idea, he thought a fraction before Bucky’s hand slid down the front of him. He let out a groan, his hips jolting forwards, he dropped his forehead to Buck’s shoulder, “fuck...shit. N-NO! Don’t stop...”
Bucky worked his hand over him, he liked the way Steve screwed his eyes shut, his chest rising and falling faster, hips bucking into his hand. He looked so fucking sexy, he couldn’t help but kiss him, anywhere.
Steve jolted as he felt Bucky’s lips against his neck, followed by his tongue, his self control was cracking. He moved Bucky, hands pushing him towards the couch till they toppled over onto it. He growled as Bucky’s hands fell on his chest, “you said...what I wanted.” Steve closed his eyes, nodding as he took in a calming breath. Bucky shimmied, maneuvering them till Steve was laying on his back with Buck straddling him.
Steve’s eyes were dark, lust blown and Bucky felt for the first time as if he was in control. Truly in control, it was something that he hadn’t felt in such a long time. He moved his hips, Steve’s large hands moving to his waist and he caught his wrists, he swallowed as he held Steve’s gaze, raising his hands above his head and grinding down on him. The moan drove him forwards grinding down faster, “fuck baby, don’t stop, don’t stop.”
“S-Steve...Steve, ahhh, mmngh, gonna, g-gonna-” Steve bucked up, freeing a hand he reached up and jerked Bucky down, swallowing his cry with a kiss. Steve grunted as Bucky fell atop him, completely boneless. “Shit...”
“Alright?”
Bucky nodded, the only movement he could muster as he attempted to catch his breath. “Steve?”
“Mmmmn?”
“A-are..... are you my boyfriend?”
Steve was silent a moment, “I’m a fuckin idiot... I thought.. I thought I made that clear?” Steve laughed, “Do you want me to be?”
Bucky felt lightheaded, “Yes!!” he exclaimed a little louder than he intended head lifting up and those blue eyes brightened. Steve could feel his chest warm, he had it bad, he would do anything to see that expression on his face more often.
A frown appeared on his lips and he was about to ask when Bucky hummed thoughtfully. “Shit... just... wait! I can wash your pants!!” he sat up, pushing himself up and looking over at Steve.
Steve blinked, confused at the sudden change in topic, “uh, oh!” He draped and arm over his eyes, a low chuckle rumbling through his chest. “Just, yeah, we can do that...” he lifted his arm, peeking out from under it, “might have to stay the night...?”
Bucky smiled, “well, that’s just t he worst! What am I gonn-” he let out a yelp as Steve jerked him into his arms, shutting him up with a kiss. He’d worry about everything later, right now he was gonna enjoy the man beneath him.
*****
A/N: Sorry it’s been a minute since I updated this fic!! I been busy and trying to get my head to stop coming up with other crap.... Ahhh’m sorry! Please enjoy and thank you so much for reading!!!!
As always I love any comments you leave and appreciate them tremendously!!
Perma tags:@shamvictoria11 @hellkat2 @the-great-irene @mo320 @magellan-88 @lostinspace33 @tamianich @incadinkadoo @aquabrie @dustycelt @yknott81 @arwa-alii @alyssaj23 @insideoflit @debbielovesbucky @swtwtrgin @saysay125 @rda1989 @xxxprettydeadgirlxxx @whenallsaidanddone @s7sense @vaisabu @the-witching-hours12-3 @learisa @goodnightwife @roselock20 @everybodycriesonce @pegasusdragontiger @suz-123 @lostinthoughtsandfeelings @50shadesofyes @iamwarrenspeace @strange-intricate-dysfunction @lloeppky @feelmyroarrrr @red-writer13 @crystalsnow0304 @badassbaker @sebstanchrisevanchickforever19 @supernatural-girl97 @honey-bee-holly @patzammit @oswolfpack @the-real-kellymonster @wildefire @abbessolute @sarahp879 @mummy-woves-you @thisismysecrethappyplace @georgiagrl1990 @geeksareunique
#Architecture#stucky#Steve Rogers#bucky barnes#steve x bucky#Avengers#marvel#brock rumlow#sam wilson
60 notes
·
View notes
Text
The Ultimate Showdown: Dart Final vs. Const - Which is the Best?
youtube
In the last lesson, we learned about the skeleton of the input page for our BMI calculator. We saw that when we created a property, omitting the word final would result in an error. It is important to note that when people talk about instance variables, instance fields, or properties, they are all the same thing: the property that can be changed inside the class or when we construct the class. Immutability is another term used to describe something that is unchangeable, such as a Lego block. In order to make changes to our app, one can destroy an immutable widget and replace it with a new one.
#edudreams#flutter#dart#flutterdev#fluttercommunity#flutterapp#flutterdevelopers#flutterdeveloper#development#programming#developer#fullstackdeveloper#coding#Youtube
0 notes
Text
The Ultimate Showdown: Dart Final vs. Const - Which is the Best?
youtube
In the last lesson, we learned about the skeleton of the input page for our BMI calculator. We saw that when we created a property, omitting the word final would result in an error. It is important to note that when people talk about instance variables, instance fields, or properties, they are all the same thing: the property that can be changed inside the class or when we construct the class. Immutability is another term used to describe something that is unchangeable, such as a Lego block. In order to make changes to our app, one can destroy an immutable widget and replace it with a new one.
#edudreams#flutter#dart#flutterdev#fluttercommunity#flutterapp#flutterdevelopers#flutterdeveloper#programming#development#developer#coding#Youtube
0 notes
Text
Managing Offline Data Storage With Flutter Hive
Have you ever heard the name flutter hive? Nearly every app needs local storage for its data. Apps, including those built with Flutter, rely heavily on the ability to store and manipulate data. The replies from a REST API may be cached, an offline app could be developed, or data about customers could be saved for a food delivery service. Flutter provides developers with a number of mechanisms for saving state locally.
Of course, Flutter hive is one of the finest options for offline data storage if you need a fast and secure local database compatible with Flutter Web().
What is Flutter Hive?
Hive is a very fast and small key-value database developed entirely in Dart that can be used to store and synchronize data for applications even when not online.
Hive is a high-performance, Dart-based key-value data store that works with simple and complicated data structures. It is also encrypted with AES-256 for further security.
Steps to Take When Beginning to Manage Offline Data Storage Using Flutter Hive
This blog post will use the TypeAdapter in Flutter app development with the Hive database. Furthermore, we will develop a minimal app consisting of a single page that can be used to see a directory of users, create new users, edit current ones, or remove old ones.
Step 1- First, install any necessary dependencies.
Two prerequisites must be met before Hive can be used.
hive and hive_flutter
The packages Hive and hive flutter must be included to pubspec.yaml.
dependencies: Flutter: sdk: flutter hive: ^2.2.3 hive_flutter: ^1.1.0Add the dev dependenciesdev_dependencies: flutter_test: sdk: flutterhive_generator: ^1.1.3build_runner: ^2.2.0Step 2: Initialization of Hive Database
Before we can proceed with executing runApp in the Flutter app, we must first initialize Hive.
void main() async{ WidgetsFlutterBinding.ensureInitialized(); // Initializes Hive with a valid directory in your app files await Hive.initFlutter(); runApp(const MyApp());}
Hive is responsible for providing the initFlutter() method. Hive is essentially initialized by using the path given by the getApplicationDocumentsDirectory command.
What is a Box in Flutter Hive?
Using boxes, Flutter Hive categorizes the information it stores. The container looks like a SQL table but lacks any particular formatting and may store anything at all. Hive encrypts data, as indicated at the outset. Sensitive information may also be stored in encrypted boxes.
Hive saves its information in the form of key-value sets. You should start by opening the package.
void main() async{ WidgetsFlutterBinding.ensureInitialized();// Initializes Hive with a valid directory in your app files await Hive.initFlutter();// open boxawait Hive.openBox("userBox");runApp(const MyApp());}
Model Class With TypeAdapter
Our illustration includes a number of users, each with information such as their name, hobbies, and descriptions.
lib/models/person.dartimport 'package:hive/hive.dart';part 'person.g.dart';@HiveType(typeId: 1)class Person { @HiveField(0) final String name; @HiveField(1) final String country; Person({ required this.name, required this.country, });}
It is necessary to import the hive first. The type adapter may be generated by including the user model.g.dart file. Since we’re using the hive generator package, building a TypeAdapter from scratch is unnecessary.
TypeAdapters are generated automatically for almost all classes using the hive generator package. Several fields are marked in the userModel class.
Use @HiveType() to provide the model class and let the generator know it should produce a TypeAdapter.
The class’s fields must be annotated with @HiveField(index) and the matching index.
Execute the following command to build a TypeAdapter class:
flutter packages pub run build_runner build
Here an additional file, data model.g.dart (where g denotes “generated”), will be appended to the existing user model.dart. The resulting filename would be user model.g.dart.
CRUD Operations
Creating Data in Hive
/// Add new userFuture addUser({required UserModel userModel}) async { await box.add(userModel);}
When we touch the floating button, a dialogue window appears where you may get details such as our name, interests, and bio. Then we’ll click the “add” button, and information will populate.
The Flutter Hive ValuelistenableBuilder() stream may eavesdrop on activities inside the container.
Retrieving Data in Flutter Hive
lib/screens/add_screen.dartimport 'package:flutter/material.dart';import 'package:hive_demo/utils/add_person_form.dart';class AddScreen extends StatefulWidget { @override _AddScreenState createState() => _AddScreenState();}class _AddScreenState extends State<addscreen> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( title: Text('Add Info'), ), body: Padding( padding: const EdgeInsets.all(16.0), child: AddPersonForm(), ), ); }}</addscreen>lib/screens/info_screen.dartimport 'package:flutter/material.dart';import 'package:hive_demo/screens/update_screen.dart';import 'package:hive_flutter/hive_flutter.dart';import 'package:hive_demo/screens/add_screen.dart';class InfoScreen extends StatefulWidget { @override _InfoScreenState createState() => _InfoScreenState();}class _InfoScreenState extends State<infoscreen> { late final Box contactBox; // Delete info from people box _deleteInfo(int index) { contactBox.deleteAt(index); print('Item deleted from box at index: $index'); } @override void initState() { super.initState(); // Get reference to an already opened box contactBox = Hive.box('peopleBox'); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('People Info'), ), floatingActionButton: FloatingActionButton( onPressed: () => Navigator.of(context).push( MaterialPageRoute( builder: (context) => AddScreen(), ), ), child: Icon(Icons.add), ), body: ValueListenableBuilder( valueListenable: contactBox.listenable(), builder: (context, Box box, widget) { if (box.isEmpty) { return Center( child: Text('Empty'), ); } else { return ListView.builder( itemCount: box.length, itemBuilder: (context, index) { var currentBox = box; var personData = currentBox.getAt(index)!; return InkWell( onTap: () => Navigator.of(context).push( MaterialPageRoute( builder: (context) => UpdateScreen( index: index, person: personData, ), ), ), child: ListTile( title: Text(personData.name), subtitle: Text(personData.country), trailing: IconButton( onPressed: () => _deleteInfo(index), icon: Icon( Icons.delete, color: Colors.red, ), ), ), ); }, ); } }, ), ); }}</infoscreen>lib/screens/update_screen.dartimport 'package:flutter/material.dart';import 'package:hive_demo/models/person.dart';import 'package:hive_demo/utils/update_person_form.dart';class UpdateScreen extends StatefulWidget { final int index; final Person person; const UpdateScreen({ required this.index, required this.person, }); @override _UpdateScreenState createState() => _UpdateScreenState();}class _UpdateScreenState extends State<updatescreen> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( title: Text('Update Info'), ), body: Padding( padding: const EdgeInsets.all(16.0), child: UpdatePersonForm( index: widget.index, person: widget.person, ), ), ); }}</updatescreen>lib/utils/add_person_form.dartimport 'package:flutter/material.dart';import 'package:hive/hive.dart';import 'package:hive_demo/models/person.dart';class AddPersonForm extends StatefulWidget { const AddPersonForm({Key? key}) : super(key: key); @override _AddPersonFormState createState() => _AddPersonFormState();}class _AddPersonFormState extends State<addpersonform> { final _nameController = TextEditingController(); final _countryController = TextEditingController(); final _personFormKey = GlobalKey<formstate>(); late final Box box; String? _fieldValidator(String? value) { if (value == null || value.isEmpty) { return 'Field can\'t be empty'; } return null; } // Add info to people box _addInfo() async { Person newPerson = Person( name: _nameController.text, country: _countryController.text, ); box.add(newPerson); print('Info added to box!'); } @override void initState() { super.initState(); // Get reference to an already opened box box = Hive.box('peopleBox'); } @override Widget build(BuildContext context) { return Form( key: _personFormKey, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Name'), TextFormField( controller: _nameController, validator: _fieldValidator, ), SizedBox(height: 24.0), Text('Home Country'), TextFormField( controller: _countryController, validator: _fieldValidator, ), Spacer(), Padding( padding: const EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 24.0), child: Container( width: double.maxFinite, height: 50, child: ElevatedButton( onPressed: () { if (_personFormKey.currentState!.validate()) { _addInfo(); Navigator.of(context).pop(); } }, child: Text('Add'), ), ), ), ], ), ); }}</formstate></addpersonform>lib/utils/update_person_form.dartimport 'package:flutter/material.dart';import 'package:hive/hive.dart';import 'package:hive_demo/models/person.dart';class UpdatePersonForm extends StatefulWidget { final int index; final Person person; const UpdatePersonForm({ required this.index, required this.person, }); @override _UpdatePersonFormState createState() => _UpdatePersonFormState();}class _UpdatePersonFormState extends State<updatepersonform> { final _personFormKey = GlobalKey<formstate>(); late final _nameController; late final _countryController; late final Box box; String? _fieldValidator(String? value) { if (value == null || value.isEmpty) { return 'Field can\'t be empty'; } return null; } // Update info of people box _updateInfo() { Person newPerson = Person( name: _nameController.text, country: _countryController.text, ); box.putAt(widget.index, newPerson); print('Info updated in box!'); } @override void initState() { super.initState(); // Get reference to an already opened box box = Hive.box('peopleBox'); _nameController = TextEditingController(text: widget.person.name); _countryController = TextEditingController(text: widget.person.country); } @override Widget build(BuildContext context) { return Form( key: _personFormKey, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Name'), TextFormField( controller: _nameController, validator: _fieldValidator, ), SizedBox(height: 24.0), Text('Home Country'), TextFormField( controller: _countryController, validator: _fieldValidator, ), Spacer(), Padding( padding: const EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 24.0), child: Container( width: double.maxFinite, height: 50, child: ElevatedButton( onPressed: () { if (_personFormKey.currentState!.validate()) { _updateInfo(); Navigator.of(context).pop(); } }, child: Text('Update'), ), ), ), ], ), ); }}</formstate></updatepersonform>lib/main.dartimport 'package:flutter/material.dart';import 'package:hive_demo/models/person.dart';import 'package:hive_flutter/hive_flutter.dart';import 'screens/info_screen.dart';main() async { // Initialize hive await Hive.initFlutter(); // Registering the adapter Hive.registerAdapter(PersonAdapter()); // Opening the box await Hive.openBox('peopleBox'); runApp(MyApp());}class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState();}class _MyAppState extends State<myapp> { @override void dispose() { // Closes all Hive boxes Hive.close(); super.dispose(); } @override Widget build(BuildContext context) { return MaterialApp( title: 'Hive Demo', theme: ThemeData( primarySwatch: Colors.purple, ), debugShowCheckedModeBanner: false, home: InfoScreen(), ); }}</myapp>
Updating Data in Flutter Hive
Information associated with a key may be modified using the put() function.
With this, the previously-provided value will be replaced with the new one at that key.
/// update user dataFuture updateUser({required int index,required UserModel userModel}) async { await box.putAt(index,userModel);
Output
Here, we’re taking use of auto-incrementing values; to make a change based on the index, just call the putAt(index) function on the box object.
Conclusion
Hive is a simple, quick, and secure NoSQL database. An API or developer language is often used to store, retrieve, search, update, query, and otherwise change data in a database. These tasks often occur behind the scenes of a program, undetected by users. Hence, the hive has an efficient database, and particularly, it is blazing rapidly, and it supports almost all platforms.
This article will explain the handling the offline storage with a Flutter hive. However, this functionality will aid you in creating high-quality and feature-rich apps with a few lines of coding! I hope you guys have a clear idea about handling the offline data in Flutter development. To integrate this functionality into your application, you can hire Flutter app experts to make an app innovative and with the latest features. Let’s get started and share your project requirements with us.
Frequently Asked Questions (FAQs)
1. What is Hive? and why is it used?
Hive is lightweight and has a fast key-value database written in Dart language. It grants you to store and sync application info offline. Thus, it is used to aid primitive and complicated data structures while delivering a high level of performance in the application.
2. How will you get the data from a hive database in Flutter?
Step 1: Install and Initialize the hive database
Step 2: Import hive and generate the type adapter
Step 3: Insert user_model.g.dart to automatically create a userModel class using the hive generator package.
Step 4: Write that type of adapter before calling the run app function to register UserModelAdapter
3. How to store data locally in Flutter with Hive?
To store data locally in Flutter with Hive, you can follow these general steps:
Define your data model
Initialize Hive
Open a Hive box
Write data to the box
Read data from the box
Close the box
4. How do I integrate my flutter app with hive?
Install the Hive package: Add the hive and hive_flutter packages to your pubspec.yaml file and run flutter pub get to install them.
Define your Hive data model: Create a class that extends from HiveObject and define the fields that you want to store in Hive.
Initialize Hive: In your app’s main method, initialize Hive by calling Hive.initFlutter().
Open a Hive box: To open a Hive box, call Hive.openBox() and pass in a unique name for your box.
Read and write data: To read data from your Hive box, call Box.get() the key for the data you want to read. To write data to your Hive box, call Box.put() with the key and the data you want to write.
Originally Published At: https://flutteragency.com/manage-offline-data-storage-flutter-hive/
0 notes
Text
Final vs Const at Dart Lang
"final" means single-assignment: a final variable or field must have an initializer. Once assigned a value, a final variable's value cannot be changed. final modifies variables.
"const" has a meaning that's a bit more complex and subtle in Dart. const modifies values. You can use it when creating collections, like const [1, 2, 3], and when constructing objects (instead of new) like const Point(2, 3). Here, const means that the object's entire deep state can be determined entirely at compile time and that the object will be frozen and completely immutable.
So, what does this mean?
Const: If the value you have is computed at runtime (new DateTime.now(), for example), you can not use a const for it. However, if the value is known at compile time (const a = 1;), then you should use const over final. There are 2 other large differences between const and final. Firstly, if you're using const inside a class, you have to declare it as static const rather than just const. Secondly, if you have a const collection, everything inside of that is in const. If you have a final collection, everything inside of that is not final.
Final: final should be used over const if you don't know the value at compile time, and it will be calculated/grabbed at runtime. If you want an HTTP response that can't be changed, if you want to get something from a database, or if you want to read from a local file, use final. Anything that isn't known at compile time should be final over const.
https://stackoverflow.com/questions/50431055/what-is-the-difference-between-the-const-and-final-keywords-in-dart
0 notes