This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| protocol ProductServiceProtocol { | |
| func getProducts(page: Int, limit: Int) async throws -> [Product] | |
| func getProduct(id: String) async throws -> Product | |
| func createProduct(_ request: CreateProductRequest) async throws -> Product | |
| func updateProduct(id: String, _ request: UpdateProductRequest) async throws -> Product | |
| func deleteProduct(id: String) async throws | |
| func searchProducts(query: String) async throws -> [Product] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| // NetworkError.swift | |
| enum NetworkError: LocalizedError { | |
| case invalidURL | |
| case invalidResponse | |
| case httpError(statusCode: Int) | |
| case decodingError(Error) | |
| case networkError(Error) | |
| case unauthorized |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(const MyApp()); | |
| class MyApp extends StatefulWidget { | |
| const MyApp({super.key}); | |
| @override | |
| State<MyApp> createState() => _MyAppState(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({super.key}); | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final productResults = await _odooClient.callKw({ | |
| 'model': 'product.template', // Selecting from 'product.template' model | |
| 'method': 'search_read', | |
| 'args': [], | |
| 'kwargs': { | |
| 'domain': [ | |
| ['sale_ok', '=', true], // WHERE sale_ok = true | |
| ['list_price', '>', 100.0], // AND list_price > 100.0 | |
| '|', // OR (applies to the next two conditions) | |
| ['type', '=', 'product'], // type = 'product' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| await _odooClient.callKw({ | |
| model: 'stock.picking', | |
| 'method': 'search_read', | |
| 'args': [], | |
| 'kwargs': { | |
| fields: ['pick_state','id', 'name', 'partner_id', 'date', 'sale_id','invoice_number', 'app_driver'], | |
| }, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:convert'; | |
| import 'dart:developer'; | |
| import 'package:http/http.dart' as http; | |
| import 'package:shared_preferences/shared_preferences.dart'; | |
| class OdooRpcClient { | |
| final String baseUrl; | |
| final String db; | |
| String? _sessionId; // To store the session ID | |
| final String _authPath = '/web/session/authenticate'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // pubspec.yaml | |
| // Add these dependencies: | |
| // dependencies: | |
| // flutter: | |
| // sdk: flutter | |
| // dio: ^5.4.0 # Or the latest version | |
| // provider: ^6.0.5 # Or the latest version | |
| // json_annotation: ^4.8.1 | |
| // cached_network_image: ^3.3.1 | |
| // shared_preferences: ^2.2.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({super.key}); | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/services.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({super.key}); |
NewerOlder